본문 바로가기
秋 - Tip

새로운 서버가 들어왔습니다. 하나도 신나지 않습니다

by 민수아빠™ 2002. 9. 11.

꽤비싼 서버가 들어왔습니다. 하지만 하나도 신나지 않습니다.

아무리 신나지 않아도 서버 세팅은 해야 합니다.
세팅하는 일은 신나지 않을 수 없는 일입니다.
당연히 이렇게 정리하는일도 신나는 일입니다.

먼저 apache를 제거합니다. 제가할거 왜 설치했냐고 묻지 마세요..
그냥 기본사항으로 설치하는게 시간이 적게 걸립니다.

기준은 RedHat Advanced Server 2.1을 Server사양 기본사항으로 설치하였습니다.



[root@arch root]# /etc/rc.d/init.d/httpd start
httpd (을)를 시작합니다:                                   [  확인  ]
기본적으로 httpd데몬은 뜨지 않습니다. 실행을 확인합니다.

[root@arch root]# /etc/rc.d/init.d/httpd stop
httpd 를 정지함:                                           [  확인  ]
확인 되었으면 정지합니다.

[root@arch root]# ps -ef | grep httpd            
root     19779 19645  0 20:47 pts/0    00:00:00 grep httpd
정지되었는지 확인합니다.


[root@arch root]# ps -ef | grep mysql
root     19781 19645  0 20:47 pts/0    00:00:00 grep mysql
mysql은 설치도 되어있지 않습니다.

[root@arch root]# rpm -qa | grep apache
apache-1.3.23-10
apacheconf-0.8.1-1
apache-devel-1.3.23-10

rpm으로 설치된 apache 정보를 봅니다.


[root@arch root]# rpm -qa | grep mysql
rpm으로 설치된 mysql정보를 봅니다. 없군요..

root     19796 19645  0 20:53 pts/0    00:00:00 grep MySQL
[root@arch root]# rpm -qa | grep MySQL
역시나 MySQL은 없군요. 설치된 배포판에 따라 MySQL로 검색해야하는 경우가 있더라구요.


[root@arch root]# rpm -qa | grep php  
asp2php-gtk-0.75.17-1
php-ldap-4.0.6-16
asp2php-0.75.17-1
php-4.0.6-16
rpm으로 설치된 php정보를 봅니다. 아~~ 4.0.6이군요. 구닥다립니다.

[root@arch root]# rpm -qa | grep imapl
역시 imap이 설치되어있을리가 없습니다.

[root@arch root]#
[root@arch root]#
[root@arch root]# rpm -e apache
오류: 이 패키지들을 제거할 경우 의존성이 깨질 수 있음:
        apache (은)는 apacheconf-0.8.1-1 에서 필요로 합니다
        apache (은)는 piranha-0.7.0-3 에서 필요로 합니다
        webserver   (은)는 mod_dav-1.0.3-4 에서 필요로 합니다
        webserver (은)는 mod_perl-1.26-2 에서 필요로 합니다
        webserver (은)는 mod_ssl-2.8.7-3 에서 필요로 합니다
        webserver (은)는 webalizer-2.01_09-0.72 에서 필요로 합니다

의존성이 있는 패키지들이 뜬다. 각각 지워보자.


[root@arch root]# rpm -e apacheconf-0.8.1-1
[root@arch root]# rpm -e piranha
[root@arch root]# rpm -e mod_dav
[root@arch root]# rpm -e mod_perl
[root@arch root]# rpm -e mod_ssl
[root@arch root]# rpm -e webalizer

이제 설치를 합니다. 설치할 내용은 아래와 같습니다.
뭐가 더 필요할지는 좀더 천천히 생각해 보도록 하겠습니다.

[root@arch tmp]# ll
합계 30518
-rw-rw-r--    1 www      www       1479475  9월 11 21:12 ZendOptimizer-2[1].0.0-Linux_glibc21-i386.tar.gz
-rw-rw-r--    1 www      www       3773671  9월  9 15:16 apache_1.3.26-i686-whatever-linux22.tar.gz
-rw-rw-r--    1 www      www       6174720  9월  1 22:24 imap-2002.RC4.tar
-rw-rw-r--    1 www      www       5610668  9월  9 21:19 jakarta-tomcat-4.1.10.tar.gz
-rw-rw-r--    1 www      www        215894  9월 11 21:07 jsboard-2.0.1.tar.gz
-rw-rw-r--    1 www      www       9592960  9월  1 22:43 mysql-3.23.52-pc-linux-gnu-i686.tar.gz
-rw-rw-r--    1 www      www       3398911  9월  2 00:43 php-4.2.2.tar.gz
-rw-rw-r--    1 www      www        418680  9월 11 21:06 webalizer-2.01-10-src.tgz
-rw-rw-r--    1 www      www        423480  9월  1 23:50 zb41pl2.tar.Z

IMAP설치.....설치할지 말지 고민입니다. 어짜피 메일 받을 일도 없을텐데...
계정을 주지 않을 예정입니다.

[root@arch tmp]# tar xvf imap-2002.TC4.tar
................주루룩.....
imap-2002.RC4/CONTENTS
imap-2002.RC4/makefile.os2
imap-2002.RC4/WARNING
imap-2002.RC4/makefile.w2k
imap-2002.RC4/CPYRIGHT
imap-2002.RC4/SUPPORT
[root@arch tmp]# mv imap-2002.RC4 /usr/local/imap
[root@arch tmp]# cd /usr/local/imap
[root@arch imap]# vi README

-------------------------------------------------------------------------------------------
                           IMAP Toolkit Environment
                               20 December 2001
                           IMAP Toolkit Environment
                               20 December 2001
                                 Mark Crispin


                            UNIX QUICK BUILD NOTES

1) Look in imap-2002/Makefile and find your system type code.  For example,
   modern versions of Linux will use either "slx" or "lnp".

2) Type "make" followed by the system type, e.g. "make slx".

3) Install the POP2 daemon (ipopd/ipop2d), the POP3 daemon (ipopd/ipop3d), and
   the IMAP daemon (imapd/imapd) on a system directory of your choosing.

4) Update /etc/services to register the pop2 service on TCP port 109, the
   pop3 service on TCP port 110, and the imap service on TCP port 143.  Also
   update Yellow Pages/NIS/NetInfo/etc. if appropriate on your system.

5) Update /etc/inetd.conf to invoke the POP2, POP3, and IMAP daemons on their
   associated services.

6) That's all!

Read the file docs/BUILD if you need more detailed information and/or you
don't understand these quick build instructions.
^L
                             MISCELLANEOUS NOTES

     mtest has been run under UNIX, DOS, Windows, NT, Macintosh, TOPS-20, and
VMS.  It is a very primitive interface, however, and is suited mainly as a
model of how to write a main program for c-client.  You should take a look at
the source to figure out how to use it.  Briefly, it first asks for a mailbox
name (either a local file path or an IMAP mailbox in the form
"{hostname}mailbox") and then puts you in a command mode where "?" will give
you a list of commands.

     Pine is available separately on the FTP.CAC.Washington.EDU archives.

     The focus of development and support is for UNIX and Win32 (including
Windows 95/98/Millenium, Windows NT, and Windows 2000).  The other ports are
not frequently used or tested, and may be incomplete.

-------------------------------------------------------------------------------------------
[root@arch imap]# make slx
...주루룩......컴파~~일..주루룩........

중략...

make[2]: 나감 `/usr/local/imap/tmail' 디렉토리
make[1]: 나감 `/usr/local/imap' 디렉토리
[root@arch imap]#
[root@arch imap]# cp imapd/imapd /usr/sbin
[root@arch imap]# cp ipopd/ipop3d /usr/sbin
[root@arch imap]#
디렉토리를 복사합니다.


[root@arch imap]# vi /etc/xinetd.d/imapd
service imap
{
        disable = no
        socket_type = stream
        wait  = no
        user = root
        server = /usr/sbin/imapd
        log_on_success += DURATION USERID
        log_on_failure += USERID
}



[root@arch imap]# vi /etc/xinetd.d/ipop3d

service pop3
{
        disable = no
        socket_type = stream
        wait  = no
        user = root
        server = /usr/sbin/ipop3d
        log_on_success += USERID
        log_on_failure += USERID
}

[root@arch imap]# /etc/rc.d/init.d/xinetd restart
xinetd 를 정지함:                                          [  확인  ]
xinetd (을)를 시작합니다:                                  [  확인  ]
[root@arch imap]#
[root@arch imap]#
[root@arch imap]#
[root@arch imap]# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK POP3 localhost.localdomain v2001.80 server ready
user www
+OK User name accepted, password please
pass skdmldkagh
+OK Mailbox open, 0 messages
quit
+OK Sayonara
Connection closed by foreign host.
[root@arch imap]#
[root@arch local]# cd /tmp    
[root@arch tmp]# tar zxvf mysql-3.23.52-pc-linux-gnu-i686.tar.gz
..주루룩...

[root@arch tmp]# cd mysql-3.23.52-pc-linux-gnu-i686
[root@arch mysql-3.23.52-pc-linux-gnu-i686]# vi INSTALL-BINARY

--------------------------------------------------------------------------------------

Installing a MySQL Binary Distribution
======================================

* Menu:

* Linux-RPM::                   Linux RPM files
* Building clients::            Building client programs

You need the following tools to install a MySQL binary distribution:

   * GNU `gunzip' to uncompress the distribution.

   * A reasonable `tar' to unpack the distribution. GNU `tar' is known
     to work.  Sun `tar' is known to have problems.

An alternative installation method under Linux is to use RPM (RedHat
Package Manager) distributions.  *Note Linux-RPM::.

If you run into problems, *PLEASE ALWAYS USE* `mysqlbug' when posting
questions to .  Even if the problem isn't a bug,
`mysqlbug' gathers system information that will help others solve your
problem.  By not using `mysqlbug', you lessen the likelihood of getting
a solution to your problem!  You will find `mysqlbug' in the `bin'
directory after you unpack the distribution.  *Note Bug reports::.

The basic commands you must execute to install and use a MySQL binary
distribution are:

     shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> cd /usr/local
     shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
     shell> ln -s mysql-VERSION-OS mysql
     shell> cd mysql
     shell> scripts/mysql_install_db
     shell> chown -R root  /usr/local/mysql
     shell> chown -R mysql /usr/local/mysql/data
     shell> chgrp -R mysql /usr/local/mysql
     shell> chown -R root /usr/local/mysql/bin
     shell> bin/safe_mysqld --user=mysql &

후략....

--------------------------------------------------------------------------------------


[root@arch mysql-3.23.52-pc-linux-gnu-i686]# cd ..
[root@arch tmp]# groupadd mysql
[root@arch tmp]# useradd -g mysql mysql
[root@arch tmp]# cd ..
[root@arch tmp]# mv mysql-3.23.52-pc-linux-gnu-i686 /usr/local/    
[root@arch tmp]# cd /usr/local
[root@arch local]# ln -s mysql-3.23.52-pc-linux-gnu-i686/ mysql
[root@arch local]# cd mysql
[root@arch mysql]# [root@arch mysql]# ./scripts/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
020911 21:48:31  ./bin/mysqld: Shutdown Complete


To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
./bin/mysqladmin -u root  password 'new-password'
./bin/mysqladmin -u root -h arch.knu.ac.kr  password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/safe_mysqld &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; run-all-tests

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com

:q!
[root@arch mysql]#
[root@arch mysql]# chown -R root /usr/local/mysql
[root@arch mysql]# chown -R mysql /usr/local/mysql/data
[root@arch mysql]# chgrp -R mysql /usr/local/mysql
[root@arch mysql]# chown -R root /usr/local/mysql/bin
[root@arch mysql]# ./bin/safe_mysqld --user=mysql &
[1] 20785
[root@arch mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data

[root@arch mysql]#
[root@arch mysql]# ./bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1 to server version: 3.23.52

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> quit;
Bye
[root@arch mysql]# vi /etc/profile

PATH="$PATH:/usr/X11R6/bin:/usr/local/mysql/bin"

[root@arch mysql]# vi /etc/rc.d/rc.local

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql --language=korean &'



[root@arch mysql]# cd /tmp
[root@arch tmp]# tar zxvf php-4.2.2.tar.gz
[root@arch tmp]# cd php-4.2.2
[root@arch php-4.2.2]# vi INSTALL


http://www.php.net/manual/en/install.apache.php 의 내용.
-------------------------------------------------------------------------------------------
1.  gunzip apache_xxx.tar.gz
2.  tar -xvf apache_xxx.tar
3.  gunzip php-xxx.tar.gz
4.  tar -xvf php-xxx.tar
5.  cd apache_xxx
6.  ./configure --prefix=/www --enable-module=so
7.  make
8.  make install
9.  cd ../php-xxx
10. ./configure --with-mysql --with-apxs=/www/bin/apxs
11. make
12. make install

  If you decide to change your configure options after installation
  you only need to repeat the last three steps. You only need to
  restart apache for the new module to take effect. A recompile of
  Apache is not needed.

11. cp php.ini-dist /usr/local/lib/php.ini

  You can edit your .ini file to set PHP options.  If
  you prefer this file in another location, use
  --with-config-file-path=/path in step 8.

12. Edit your httpd.conf or srm.conf file and check that these lines are
    present and not commented out:
 
   AddType application/x-httpd-php .php

   LoadModule php4_module        libexec/libphp4.so

  You can choose any extension you wish here.  .php is simply the one
  we suggest. You can even include .html, and .php3 can be added for
  backwards compatibility.

  The path on the right hand side of the LoadModule statement must point
  to the path of the PHP module on your system. The above statement is
  correct for the steps shown above.


13. Use your normal procedure for starting the Apache server. (You must
    stop and restart the server, not just cause the server to reload by
    use a HUP or USR1 signal.)
--------------------------------------------------------------------------------


[root@arch tmp]# tar zxvf apache_1.3.26-i686-whatever-linux22.tar.gz


php와 apache 깔자.


[root@arch apache_1.3.26]# ./configure --prefix=/usr/local/apache --enable-module=so --enable-rule=SHARED_CORE --enable-shared=max
[root@arch apache_1.3.26]# make
[root@arch apache_1.3.26]# make install
전략..
+--------------------------------------------------------+
| You now have successfully built and installed the      |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the         |
| (initially created or preserved) configuration files   |
|                                                        |
|   /usr/local/apache/conf/httpd.conf
|                                                        |
| and then you should be able to immediately fire up     |
| Apache the first time by running:                      |
|                                                        |
|   /usr/local/apache/bin/apachectl start
|                                                        |
| Thanks for using Apache.       The Apache Group        |
|                                
http://www.apache.org/  |
+--------------------------------------------------------+


[root@arch php-4.2.2]#  ./configure --with-apxs=/usr/local/apache/bin/apxs --with-apache-install=/usr/local/apache --with-config-file-path=/usr/local/lib --with-mysql=/usr/local/mysql --with-pdflib=no --enable-track-vars --enable-magic-quotes --enable-modules=so



+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+
|                          *** NOTE ***                              |
|            The default for register_globals is now OFF!            |
|                                                                    |
| If your application relies on register_globals being ON, you       |
| should explicitly set it to on in your php.ini file.               |
| Note that you are strongly encouraged to read                      |
|
http://www.php.net/manual/en/security.registerglobals.php          |
| about the implications of having register_globals set to on, and   |
| avoid using it if possible.                                        |
+--------------------------------------------------------------------+



Thank you for using PHP.

[root@arch php-4.2.2]# make
[root@arch php-4.2.2]# make install
[root@arch php-4.2.2]# cp php.ini-dist /usr/local/lib/php.ini
[root@arch php-4.2.2]#


[root@arch php-4.2.2]#
[root@arch php-4.2.2]# /usr/local/apache/bin/apachectl start
/usr/local/apache/bin/apachectl start: httpd started
[root@arch php-4.2.2]# /usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl stop: httpd stopped


다됐네..ㅎㅎ

[root@arch php-4.2.2]# vi /usr/local/apache/conf/httpd.conf

이건 알아서 수정하도록하자.. -_-;

[root@arch init.d]# vi /etc/rc.d/init.d/httpd

#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve # HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/access.conf
# config: /etc/httpd/conf/httpd.conf
# config: /etc/httpd/conf/srm.conf

# Source function library.
. /etc/rc.d/init.d/functions

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache/bin/apachectl # 경로 수정
httpd=/usr/local/apache/bin/httpd # 경로 수정
prog=httpd
RETVAL=0

# Find the installed modules and convert their names into arguments httpd
# can use.
moduleargs() {
moduledir=/usr/local/apache/libexec # 경로 수정
moduleargs=`
/usr/bin/find ${moduledir} -type f -perm -0100 -name "*.so" | env -i tr '[:lower:]' '[:upper:]' | awk '{ gsub(/.*//,""); gsub(/^MOD_/,""); gsub(/^LIB/,""); gsub(/.SO$/,""); print "-DHAVE_" $0}'`
echo ${moduleargs}
}

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
daemon $httpd `moduleargs` $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
graceful|help|configtest)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status|fullstatus|graceful|help|configtest}"
exit 1
esac

exit $RETVAL


[root@arch init.d]# /etc/logrotate.d/apache

/usr/local/apache/logs/access_log /usr/local/apache/logs/error_log{
     missingok
     sharedscripts
     postrotate
/bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
     endscript
}


[root@arch init.d]# cd /tmp
[root@arch tmp]# tar zxvf ZendOptimizer-2[1].0.0-Linux_glibc21-i386.tar.gz
[root@arch tmp]#
[root@arch tmp]# cd ZendOptimizer-2.0.0-Linux_glibc21-i386/
[root@arch ZendOptimizer-2.0.0-Linux_glibc21-i386]# ./install

시키는데로 한다.


    $start = time();
    for ( $i = 1; $i <= 5000000; $i++ );
    $t_time = time() - $start;
    echo "Time : $t_time";
?>

처음에는 6초, Optimizer후에는 2초.


끝.