ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [CentOS 5.2] APM Setup
    Operation System/Linux ( CentOS ) 2009. 7. 3. 18:21

    [root@localhost download]# yum -y install gcc cpp gcc-c++ compat-gcc-32-g77 flex
    [root@localhost download]# wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
    --18:27:40--  http://www.ijg.org/files/jpegsrc.v7.tar.gz
    Resolving www.ijg.org... 74.54.68.254
    Connecting to www.ijg.org|74.54.68.254|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 960379 (938K) [application/x-gzip]
    Saving to: `jpegsrc.v7.tar.gz'

    100%[=======================================>] 960,379      444K/s   in 2.1s

    18:27:43 (444 KB/s) - `jpegsrc.v7.tar.gz' saved [960379/960379]

    [root@localhost download]# wget http://prdownloads.sourceforge.net/libpng/libpng-1.2.37.tar.gz?download
    --18:30:58--  http://prdownloads.sourceforge.net/libpng/libpng-1.2.37.tar.gz?download
    Resolving prdownloads.sourceforge.net... 216.34.181.59
    Connecting to prdownloads.sourceforge.net|216.34.181.59|:80... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: http://jaist.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.37.tar.gz [following]
    --18:30:58--  http://jaist.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.37.tar.gz
    Resolving jaist.dl.sourceforge.net... 150.65.7.130
    Connecting to jaist.dl.sourceforge.net|150.65.7.130|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 805380 (787K) [application/x-tar]
    Saving to: `libpng-1.2.37.tar.gz'

    100%[=======================================>] 805,380      187K/s   in 4.2s

    18:31:04 (187 KB/s) - `libpng-1.2.37.tar.gz' saved [805380/805380]

    [root@localhost download]# wget http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
    --18:32:34--  http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
    Resolving download.savannah.gnu.org... 199.232.41.75
    Connecting to download.savannah.gnu.org|199.232.41.75|:80... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.3.5.tar.gz [following]
    --18:32:35--  http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.3.5.tar.gz
    Resolving ftp.twaren.net... 140.110.123.9, 2001:e10:5c00:5::9
    Connecting to ftp.twaren.net|140.110.123.9|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1775673 (1.7M) [application/x-gzip]
    Saving to: `freetype-2.3.5.tar.gz'

    100%[=======================================>] 1,775,673    359K/s   in 5.8s

    18:32:41 (298 KB/s) - `freetype-2.3.5.tar.gz' saved [1775673/1775673]

    [root@localhost download]# wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
    --18:33:41--  http://www.libgd.org/releases/gd-2.0.35.tar.gz
    Resolving www.libgd.org... 213.251.181.15
    Connecting to www.libgd.org|213.251.181.15|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1345700 (1.3M) [application/x-gzip]
    Saving to: `gd-2.0.35.tar.gz'

    100%[=======================================>] 1,345,700    231K/s   in 5.9s

    18:33:49 (221 KB/s) - `gd-2.0.35.tar.gz' saved [1345700/1345700]

    -- jpegsrc-devel 설치하기
    [root@localhost download]# tar xvfz jpegsrc.v7.tar.gz
    [root@localhost download]# cd jpeg-7
    [root@localhost jpeg-7]# mkdir -p /usr/local/man/man1
    [root@localhost jpeg-7]# ./configure --enable-shared --enable-static
    [root@localhost jpeg-7]# make && make install
    [root@localhost jpeg-7]# cd ..

    -- libpng-devel 설치하기
    [root@localhost download]# tar xvfz libpng-1.2.37.tar.gz
    [root@localhost download]# cd libpng-1.2.37
    [root@localhost libpng-1.2.37]# ./configure
    [root@localhost libpng-1.2.37]# make && make install
    [root@localhost libpng-1.2.37]# cd ..

    -- Freetype 설치하기
    [root@localhost download]# tar xvfz freetype-2.3.5.tar.gz
    [root@localhost download]# cd freetype-2.3.5
    [root@localhost freetype-2.3.5]# ./configure
    [root@localhost freetype-2.3.5]# make && make install
    [root@localhost freetype-2.3.5]# cd ..

    -- gd-library 설치하기
    [root@localhost download]# tar xvfz gd-2.0.35.tar.gz
    [root@localhost download]# cd gd-2.0.35
    [root@localhost gd-2.0.35]# ./configure
    [root@localhost gd-2.0.35]# make && make install
    [root@localhost gd-2.0.35]# cd ..

    -- termcap-library 설치하기
    [root@localhost download]# wget http://www.sfr-fresh.com/unix/misc/termcap-1.3.1.tar.gz
    [root@localhost download]# tar xvfz termcap-1.3.1.tar.gz
    [root@localhost download]# cd termcap-1.3.1
    [root@localhost termcap-1.3.1]# ./configure
    [root@localhost termcap-1.3.1]# make && make install
    [root@localhost termcap-1.3.1]# cd ..

    -- mysql을 설치하는 과정
    [root@localhost download]# tar xvfz mysql-5.1.36.tar.gz
    ... 중략 ...
    [root@localhost download]# ls -al
    total 54856
    drwxr-xr-x  3 Fdevil Secu      4096 Jul  3 05:41 .
    drwx------  5 Fdevil Secu      4096 Jul  3 01:51 ..
    -rw-r--r--  1 root   root   6806786 Dec 13  2008 httpd-2.2.11.tar.gz
    drwxrwxrwx 33   7155 wheel     4096 Jun 16 22:50 mysql-5.1.36
    -rw-r--r--  1 root   root  36010524 Jul  3 05:41 mysql-5.1.36.tar.gz
    -rw-r--r--  1 root   root  13239065 Jun 30 06:36 php-5.3.0.tar.gz
    [root@localhost download]# cd mysql-5.1.36
    [root@localhost mysql-5.1.36]# useradd -M -s /bin/false mysql
    [root@localhost mysql-5.1.36]# ./configure --prefix=/usr/local/server/mysql --with-charset=utf8 --with-extra-charsets=all
    [root@localhost mysql-5.1.36]# make && make install
    [root@localhost mysql-5.1.36]# cp support-files/my-large.cnf /etc/my.cnf

    -- 기본 DB생성
    [root@localhost Fdevil]# cd /usr/local/server/mysql/
    [root@localhost mysql]# bin/mysql_install_db --user=mysql

    -- 디렉토리 권한 설정
    [root@localhost mysql]# chown -R root .
    [root@localhost mysql]# chown -R mysql var
    [root@localhost mysql]# chgrp -R mysql .

    -- 환경변수 등록
    [root@localhost mysql]# vi ~/.bash_profile
    # .bash_profile

    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi

    # User specific environment and startup programs

    PATH=$PATH:$HOME/bin:/usr/local/server/mysql/bin

    export PATH
    unset USERNAME
    :wq!
    [root@localhost mysql]# source ~/.bash_profile

    -- 자동실행 설정
    [root@localhost mysql]# cp share/mysql/mysql.server /etc/init.d/mysqld
    [root@localhost mysql]# chkconfig --add mysqld
    [root@localhost mysql]# chkconfig --list | grep mysqld
    mysqld    0:off  1:off  2:on  3:on  4:on  5:on  6:off

    -- root 패스워드 설정
    [root@localhost mysql]# /etc/init.d/mysqld start
    /*서비스부터 실행*/
    [root@localhost mysql]# mysql
    /*현재 패스워드가 지정되어 있지않음,,, 그렇기 때문에 종료하고 나온다 -- 데스크탑으로 직접 작업을 진행해서 스크립트가 없습니다*/
    [root@localhost mysql]# mysqladmin -u root password 암호
    /*위의 암호부분에 MySQL에서 사용할 암호를 지정해주고 엔터 -- 데스크탑으로 직접 작업을 진행해서 스크립트가 없습니다*/
    [root@localhost mysql]# mysql -u root -p
    /*root 패스워드를 입력하면 MySQL에 접속할 수 있다. -- 데스크탑으로 직접 작업을 진행해서 스크립트가 없습니다 */

    -- apache 설치
    [root@localhost download]# tar xvfz httpd-2.2.11.tar.gz
    [root@localhost httpd-2.2.11]# mkdir /usr/local/server/apache
    [root@localhost httpd-2.2.11]# ./configure --prefix=/usr/local/server/apache/ --enable-mods-shared=all --enable-so --enable-rewrite
    [root@localhost httpd-2.2.11]# make && make install

    -- apache 자동실행
    [root@localhost httpd-2.2.11]# cp /usr/local/server/apache/bin/apachectl /etc/init.d/httpd
    [root@localhost httpd-2.2.11]# vi /etc/init.d/httpd
    #!/bin/sh
    #
    # chkconfig: 2345 90 90
    # description: init file for Apache server deamon
    # procesname: /usr/local/server/apache/bin/apachectl
    # config: /usr/local/server/apache/conf/httpd.conf
    # pidfile: /usr/local/server/apache/logs/httpd.log

    #
    # Licensed to the Apache Software Foundation (ASF) under one or more
    # contributor license agreements.  See the NOTICE file distributed with
    # this work for additional information regarding copyright ownership.
    # The ASF licenses this file to You under the Apache License, Version 2.0
    # (the "License"); you may not use this file except in compliance with
    # the License.  You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    ...중략...
        $HTTPD $ARGV
        ERROR=$?
    esac

    exit $ERROR
    :wq!
    [root@localhost httpd-2.2.11]# chkconfig --add httpd
    [root@localhost httpd-2.2.11]# chkconfig --list | grep httpd
    httpd    0:off  1:off  2:on  3:on  4:on  5:on  6:off

    --httpd.conf 환경설정
    [root@localhost httpd-2.2.11]# vi /usr/local/server/apache/conf/httpd.conf
    ...중략...
    <IfModule !mpm_netware_module>
    <IfModule !mpm_winnt_module>
    #
    # If you wish httpd to run as a different user or group, you must run
    # httpd as root initially and it will switch.
    #
    # User/Group: The name (or #number) of the user/group to run httpd as.
    # It is usually good practice to create a dedicated user and group for
    # running httpd, as with most system services.
    #
    User nobody
    Group nobody


    </IfModule>
    </IfModule>
    ...중략...
    #
    # ServerAdmin: Your address, where problems with the server should be
    # e-mailed.  This address appears on some server-generated pages, such
    # as error documents.  e.g. admin@your-domain.com
    #
    ServerAdmin you@example.com

    #
    # ServerName gives the name and port that the server uses to identify itself.
    # This can often be determined automatically, but we recommend you specify
    # it explicitly to prevent problems during startup.
    #
    # If your host doesn't have a registered DNS name, enter its IP address here.
    #
    ServerName 192.168.0.2:80

    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot "/usr/local/server/apache/htdocs"
    ...중략...
    :wq!
    [root@localhost httpd-2.2.11]# /etc/init.d/httpd restart
    [root@localhost httpd-2.2.11]# vi /etc/sysconfig/iptables
    # Firewall configuration written by system-config-securitylevel
    # Manual customization of this file is not recommended.
    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    :RH-Firewall-1-INPUT - [0:0]
    -A INPUT -j RH-Firewall-1-INPUT
    -A FORWARD -j RH-Firewall-1-INPUT
    -A RH-Firewall-1-INPUT -i lo -j ACCEPT
    -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
    -A RH-Firewall-1-INPUT -p 50 -j ACCEPT
    -A RH-Firewall-1-INPUT -p 51 -j ACCEPT
    -A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
    -A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
    -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
    -A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
    -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
    -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
    -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
    COMMIT
    :wq!
    [root@localhost httpd-2.2.11]# /etc/init.d/iptables restart
    Flushing firewall rules:                                   [  OK  ]
    Setting chains to policy ACCEPT: filter                    [  OK  ]
    Unloading iptables modules:                                [  OK  ]
    Applying iptables firewall rules:                          [  OK  ]
    Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]
    [root@localhost httpd-2.2.11]#
    /*여기까지 해주고 웹페이지로 이동해서 해당아이피(192.168.0.2)또는 해당URL을 입력하시면 페이지가 뜹

    니다.*/

    -- php 설치
    [root@localhost download]# wget ftp://xmlsoft.org/libxml2/libxml2-cvs-snapshot.tar.gz
    [root@localhost download]# tar xvfz libxml2-cvs-snapshot.tar.gz
    [root@localhost download]# cd libxml2-2.7.2
    [root@localhost libxml2-2.7.2]# ./configure
    [root@localhost libxml2-2.7.2]# make && make install
    [root@localhost libxml2-2.7.2]# cd ..
    [root@localhost download]# ls
    freetype-2.3.5         httpd-2.2.11.tar.gz      php-5.3.0.tar.gz
    freetype-2.3.5.tar.gz  jpegsrc.v7.tar.gz        termcap-1.3.1
    gd-2.0.35              libpng-1.2.37.tar.gz     termcap-1.3.1.tar.gz
    gd-2.0.35.tar.gz       mysql-5.4.1-beta
    httpd-2.2.11           mysql-5.4.1-beta.tar.gz
    [root@localhost download]# tar xvfz php-5.3.0.tar.gz
    [root@localhost download]# cd php-5.3.0
    [root@localhost php-5.3.0]# mkdir /usr/local/server/php
    [root@localhost php-5.3.0]# ./configure --prefix=/usr/local/server/php --with-apxs2=/usr/local/server/apache/bin/apxs --with-mysql=/usr/local/server/mysql --with-config-file-path=/usr/local/server/apache/conf --disable-debug --enable-safe-mode --enable-track-vars --enable-sockets --with-charset=utf8 --with-xml --with-language=korean --enable-calender --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --enable-gd-native-ttf --enable-url-includes --enable-inline-optimization --enable-bcmath --with-jpeg --with-png --with-zlib --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring
    [root@localhost php-5.3.0]# make && make install
    [root@localhost php-5.3.0]# cp php.ini-dist /usr/local/server/apache/conf/php.ini
    [root@localhost php-5.3.0]# vi /usr/local/server/apache/conf/httpd.conf
    ...중략...
    </Directory>

    #
    # DirectoryIndex: sets the file that Apache will serve if a directory
    # is requested.
    #
    <IfModule dir_module>
        DirectoryIndex index.html index.htm index.php
    </IfModule>

    #
    # The following lines prevent .htaccess and .htpasswd files from being
    # viewed by Web clients.
    #
    ...중략...
    DefaultType text/plain

    <IfModule mime_module>
        #
        # TypesConfig points to the file containing the list of mappings from
        # filename extension to MIME-type.
        #
        TypesConfig conf/mime.types

        #
        # AddType allows you to add to or override the MIME configuration
        # file specified in TypesConfig for specific file types.
        #
        #AddType application/x-gzip .tgz
        #
        # AddEncoding allows you to have certain browsers uncompress
        # information on the fly. Note: Not all browsers support this.
        #
        #AddEncoding x-compress .Z
        #AddEncoding x-gzip .gz .tgz
        #
        # If the AddEncoding directives above are commented-out, then you
        # probably should define those extensions to indicate media types:
        #
        AddType application/x-compress .Z
        AddType application/x-gzip .gz .tgz
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps

        #
        # AddHandler allows you to map certain file extensions to "handlers":
        # actions unrelated to filetype. These can be either built into the server
        # or added with the Action directive (see below)
        #
        # To use CGI scripts outside of ScriptAliased directories:
        # (You will also need to add "ExecCGI" to the "Options" directive.)
        #
        #AddHandler cgi-script .cgi

        # For type maps (negotiated resources):
        #AddHandler type-map var
    ...중략...
    :wq!
    [root@localhost php-5.3.0]# /etc/init.d/httpd restart
    httpd: Syntax error on line 104 of /usr/local/server/apache/conf/httpd.conf: Cannot load

    /usr/local/server/apache/modules/libphp5.so into server:

    /usr/local/server/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission

    denied
    [root@localhost conf]# chcon -t texrel_shlib_t /usr/local/server/apache/modules/libphp5.so
    [root@localhost conf]# /etc/init.d/httpd restart
    httpd not running, trying to start  -- 정상적으로 apache가 동작하는 것을 확인할 수 있다.


    ----------------------------------------------------------------------------------------------
    빨간색으로 표시해둔 부분은 사용자의 환경에 맞게 변경한 부분입니다.
    vi editer를 이용해서 작업을 진행하고 있으며, 시스템의 환경에 따라서 달라질 수도 있습니다.

    참고 : CentOS 리눅스 구축관리 실수
             리눅스 서버관리 실무 바이블

Designed by Tistory.