3. DNS-323에서 mysql과 php 사용하기

[참고]

1. http://81.216.140.39/dns-323/mysql_and_php/
2. http://forum.dsmg600.info/viewtopic.php?id=1737&p=3
3. http://secrice.com/writing/2008/03/24/DNS-323+lighttpd+EC9_1206337894.php
4. http://cafe.naver.com/CommentView.nhn?search.clubid=11997453&search.menuid=67&search.articleid=3295&search.replyyn=Y

 

우선 examples lighttpd.conf 파일을 etc 디렉토리에 복사한다.
cp /mnt/HD_a2/ffp/etc/examples/lighttpd.conf /mnt/HD_a2/ffp/etc/

Remove old php package if installed cd to the directory where fonz packagaes has benn downloaded
( 경우 cd /mnt/HD_a2/packages)
wget http://81.216.140.39/dns-323/mysql_and_php/mysql-5.1.28-rc-1.tgz
wget http://81.216.140.39/dns-323/mysql_and_php/php-5.2.6-mysql51-1.tgz
funpkg -i mysql-5.*.tgz
funpkg -i php-5.2.6-mysql5*.tgz

my.cnf examples 디렉토리에서 복사
cp /ffp/etc/examples/my.cnf /ffp/etc/.

mysql php 다운로드 곳에서 php.ini 다운로드 /ffp/etc 복사하고 다음의 내용을 추가
extension=gd.so
extension=mysql.so
extension=pdo.so
extension=pdo_mysql.so

see all extenstions in /ffp/lib/php/extensions/no-debug-non-zts-20060613/

마지막으로 새로운 데이터베이스 생성
mysql_install_db

리붓(웹상에서 리붓하는게 아니라 ssh 상에서 reboot 명령)하고
/ffp/bin/mysqladmin -u root password ‘new-password’
해보면 에러가

sh /ffp/start/mysqld.sh stop
sh /ffp/start/mysqld.sh start

다시 리붓하고 다음과 같이 해보면 정상적으로 작동하는 확인
mysql -u root
mysql> show databases;
mysql> quit;

다음은 php 확인

우선은 php 작동할 있도록 lighttpd.conf 파일을 수정

참고로 파일 내용을 수정할 때는 vi 명령어를 사용함
vi /ffp/etc/lighttpd.conf

수정을 하고 싶을 “a” 입력한 수정을 하면 되고 수정을 하고 그냥 끝내려면 “ESC”+”:”+”q”, 저장을 하고 끝내려면  “ESC”+”:”+”w”+”q”

php 관계없이 웹서버로 사용하기 위해 수정할 부분

  1. server.document-root = “/mnt/HD_a2/www/pages”
  2. server.upload-dirs = “/mnt/HD_a2/www/tmp”
  3. server.errorlog = “/mnt/HD_a2/www/logs/error.log”
  4. server.port = 8080
  5. 자신의 상황에 맞게 디렉토리와 포트를 수정하고 이에 맞춰서 www, pages, tmp, logs 폴더를 만들어주고 퍼미션을 777 또는 757로변경
  6. chmod 757 www

virtual directory listing 사용하기 위해 다음과 같이 수정
## virtual directory listings
dir-listing.activate        = “enable”
dir-listing.show-readme     = “enable”
dir-listing.hide-readme-file = “enable”
dir-listing.encoding        = “utf-8″
dir-listing.hide-dotfiles   = “enable”

다음은 php 관련된 부분 수정
#                              ”mod_fastcgi”,         –> #(주석처리) 제거

#### fastcgi module
## read fastcgi.txt for more info
## for PHP don’t forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/ffp/bin/php-cgi”
)
)
)
바꿔줌

다음과 같이 테스트용 페이지를 만들어 index.php 저장하고 www/pages 업로드한 웹브라우져에서 php 사양등 나오는지 테스트

<h1> PHP TEST PAGE </h1>
<?php phpinfo(); ?>
<?php $date=date(‘Y-m-d’); echo “DATE: “.$date; ?>

설치된 php의 정보들을 확인할 수 있는 페이지가 보인다면 성공

NAS에 게시됨. 태그: , , . 4개의 댓글 »

2. DNS-323에서 Telnet 실행

[참고] http://wiki.dns323.info/howto:ffp

 

###################참고사항###################

앞에서 설치한 패키지들 자동으로 시작이 되게 하고 싶은 패키지가 있다면

cd /ffp/start
chmod +x /telnetd.sh

멈춰있는 패키지를 시작 또는 정지하고 싶다면

sh telnetd.sh start
sh telnetd.sh stop

#############################################

 

If installation was successful, a telnet server has been started. It does not ask for user name and password, and directly starts a root shell.

 

A telnet client utility is available by default in Windows XP and in most Linux distributions. It’s not available in Cygwin. Windows Vista has a telnet client which is disabled by default but can be enabled easily in Control Panel → Programs → Programs And Features → Turn Windows features on or off → Telnet Client.

확인을 눌렀을 때 프롬프트창이 실행되면 정상적으로 설치된 것이다.

The root user

‘root’ is the system administrator on Linux. A lot of tasks require root permissions, it’s essential to have a working root account.

The firmware comes with a disabled root account that cannot login the ‘normal’ way. For this reason, the funplug starts an open telnet server that circumvents the normal login procedure to provide a root shell directly.

To fix the root account, you should run pwconv to update /etc/shadow, set a password and change the shell:

pwconv
passwd
usermod -s /ffp/bin/sh root

If you omit the usermod command, login will start the shell configured for root in /etc/passwd. Usually, this is the firmware shell /bin/sh (requires unlock code, type 5784468 and press Enter). For more information on shells, see the ‘Shells’ section below.

Before saving your changes, you should run additional checks on the password and group files. Some firmware versions duplicate the ftp user, and now is a good time to fix this, too.

pwck
grpck

You may ignore warnings about missing home directories and invalid group names. If asked to remove a duplicate user, say ‘yes’ to remove one of them. Rerun the commands to check that it’s fixed.

Test your changes with the login program:

login

If that worked, save the password files to flash memory:

store-passwd.sh

To enable login for telnet, edit the telnetd.sh start script and remove the ‘-l /ffp/bin/sh’ option. You can do this from the command line like this:

cd /ffp/start
sed -i ‘/flags/ s@^@#@’ telnetd.sh

Restarting telnet while logged in via telnet requires special care (the telnet session will be aborted!):

cd /tmp
nohup sh /ffp/start/telnetd.sh restart

Alternatively, you can disable telnet and start the SSH server instead. First, test ssh login:

cd /ffp/start
sh sshd.sh start

Login from a remote host now (as root, of course). If it works, disable telnet and enable sshd permanently:

cd /ffp/start
chmod a-x telnetd.sh
chmod a+x sshd.sh

이제는 보안이 취약한 텔넷으로 접속할 없고 putty TeraTerm 등을 이용해 ssh 접속해야만 하고, 리붓을 할 때도 웹상에서 DNS-323 관리자 화면에서 restart를 하는 게 아니라 ssh에서 reboot 명령어를 이용한다.

NAS에 게시됨. 태그: , , , . 댓글 달기 »

1. DNS-323에 FUN-PLUG 0.5 설치

[참고] http://www.inreto.de/dns323/fun-plug/0.5/

제일 먼저 위의 링크에서  fun_plug와 fun_plug.tgz를 Volume 1에 복사하고 reboot.
성공했다면 리붓 후 fun_plug.tgz 파일이 unpacke되어 ffp 디렉토리가 만들어지고 tgz 파일은 삭제된 것을 확인할 수 있다. 여기까지 되었으면 텔넷 서버가 시작된다.

tarball에는 다음과 같은 다양한 프로그램들이 포함되어 있다.
    * Lighttpd Web Server
    * OpenSSH Secure Shell
    * Mediatomb UPnP Media Server
    * NTP Network Time Daemon
    * UNFS3 User-Space NFS Server
    * NFS-Utils NFS Server (requires kernel support)
    * RSync File Transfer Utility

rsync를 이용해 추가적인 패키지들을 다운로드하고 설치할 수 있다:

    cd /mnt/HD_a2
    rsync -av inreto.de::dns323/fun-plug/0.5/packages .
    cd packages
    funpkg -i *.tgz

팔로우

모든 새 글을 수신함으로 전달 받으세요.