LG 유클라우드 서비스에서 apache+php 설치하기
_
_
centos5.5 apache 설치시 아래와 같이 세팅하면 apache + php를 쓸수 있음(source 설치)
클라우드 홈페이지에서 보안키 등록후 로그인하여 root 패스워드 설정(아카데미에 pdf참고)
패스워드 로그인으로 아래와 같이 수정(접속시 key파일 없이변경)
$>vi /etc/ssh/sshd_config 아래 내용처럼 주석 설정 PasswordAuthentication yes PermitEmptyPasswords no #PasswordAuthentication no $>service sshd restart |
yum 업데이트
$>yum update |
apache 필요 해당라이브러리 설치
$>yum -y install libtool $>yum install pcre-devel |
apache 설치를 위한 apr라이브러리 설치
$>wget http://apache.tt.co.kr/apr/apr-1.4.6.tar.gz $>gtar xvfz apr-1.4.6.tar.gz $>cd apr-1.4.6 $>./configure $>make && make install |
$>wget http://apache.tt.co.kr/apr/apr-util-1.4.1.tar.gz $>gtar xvfz apr-util-1.4.1.tar.gz $>cd apr-util-1.4.1 $>./configure --with-apr=/usr/local/apr $>make && make install |
apache 설치 및 설정
$>wget http://apache.tt.co.kr/httpd/httpd-2.4.3.tar.gz $>gtar xvfz httpd-2.4.3.tar.gz $>cd httpd-2.4.3 $>./configure --prefix=/usr/local/apache --enable-so --enable-rule=SHARED_CORE --enable-rewrite --enable-rewrite=shared --with-mpm=worker $>make && make install $>vi /usr/local/apache/conf/httpd.conf 수정 <- 기존 설정을 참고 |
php 설치
필요 해당 라이브러리 설치
$>yum -y install libxml2 $>yum -y install libxml2-devel |
$>wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.1.tar.gz $>tar xfz libiconv-1.9.1.tar.gz $>cd libiconv-1.9.1 $>./configure --prefix=/usr/local $>make && make install |
설치
$>wget http://www.php.net/get/php-5.4.6.tar.gz/from/kr.php.net/mirror/php-5.4.6.tar.gz $>gtar xvfz php-5.4.6.tar.gz $>cd php5.4.6 $>./configure --prefix=/usr/local/php \ --with-apxs2=/usr/local/apache/bin/apxs \ --with-iconv=/usr/local \ --enable-mbstring=all \ --enable-mbregex \ --enable-ftp \ --with-mhash \ --enable-sockets \ --enable-sigchild \ --enable-discard-path \ --enable-force-cgi-redirect \ --enable-zend-multibyte \ --enable-inline-optimization \ --enable-soap $> make && make install |
추가 디스트 설정방법(이하 기본100G 잡는법)
$>fdisk /dev/sdb1 로 설정후(primary,Linux 포맷) $>mkfs.ext3 /dev/sdb1 포맷한후 $>vi /etc/fstab 에 링크 추가 |
>NFS 서버 추가
------------서버------------
(nfs 서버 설치 확인)
$>rpm -qa | grep nfs $>nfs-utils-lib-1.0.8-3.1 $>nfs-utils-1.0.8.rc2-4.FC5.2 |
없으면
$>yum install portmap nfs-utils |
$>rpm -qa | grep portmap $>portmap-4.0-65.2.2.1 |
없으면
$>yum install portmap nfs-utils |
(nfs/portmap 서버 데몬 실행)
$>/etc/rc.d/init.d/portmap start $>/etc/rc.d/init.d/nfs start (데몬 실행 확인) $>rpcinfo -p (서비스 등록) $>chkconfig --level 3 nfs on |
(공유 디렉토리 설정) - 폴더는 아무꺼나 지정
$>mkdir/home/자기계정/mnt/nfs |
(공유 목록 관리)
$>vi /etc/exports 들어가서 /home/자기계정/mnt/nfs 222.104.154.90(rc,sync) -> 접속할 클라이언트 아이피 추가 |
위의 설정은 222.104.154.90 호스트에게만 디렉토리를 읽고 쓸 수 있게 공유한다는 의미.
(서버 리스타트)
$>/etc/rc.d/init.d/portmap restart $>/etc/rc.d/init.d/nfs restart (exportfs 명령을 이용하여 /etc/exports 파일에 설정한 공유목록이 정상적으로 공유가 되는지 확인.) $>exportfs -v /home/자기계정/mnt/nfs 222.104.154.90(rc,sync) /home/자기계정/mnt/nfs 222.104.154.91(rc,sync) |
(디렉토리 권한주기)
$>chmod 777 nfs |
---------------클라이언트------------------
(nfs 서버 설치 확인)
$>rpm -qa | grep nfs nfs-utils-lib-1.0.8-3.1 nfs-utils-1.0.8.rc2-4.FC5.2 |
없으면
$>yum install portmap nfs-utils |
$>rpm -qa | grep portmap portmap-4.0-65.2.2.1 |
없으면
$>yum install portmap nfs-utils |
(nfs/portmap 서버 데몬 실행)
$>/etc/rc.d/init.d/portmap start $>/etc/rc.d/init.d/nfs start (데몬 실행 확인) $>rpcinfo -p |
(mount 명령어를 이용하여 NFS 서버의 공유디렉토리를 사용해보자)
$>mkdir /mnt/nfs // NFS서버 폴더를 사용할 자기컴 폴더 만들기 $>mount -t 222.104.154.77:/home/공유할디렉토리/mnt/nfs /mmt/nfs //mount -t (NFS 서버주소):(공유할 디렉토리) /클라이언트 디렉토리 |
(만약 마운트가 되지 않는다면 nfs 서버의 방화벽 사용을 중지한다.
$>/etc/init.d/iptables stop (마운트 된 자기 폴더에서 mkdir 또는 touch 파일 생성) $>mkdir aaa $>touch bbb.txt |
이렇게 하면 서버 디렉토리에도 파일 생성 되고 자기 디렉토리에도 파일 생성됩니다.
(만약 부팅시 자동으로 마운트해야한다면 /etc/fstab 에 추가한다.
$>vi /etc/fstab /dev/hdc /media/cdrecorer ...... 222.104.154.77:/home/NFS서버 /mnt/nfs nfs defaults 1 2 |
(설정된 마운트를 해제하려면)
$>umount/mnt/nfs |
(정지)
$>/etc/rc.d/init.d/nfs stop $>/etc/rc.d/init.d/portmap stop $>service portmap restart $>service nfs restart |
------------------rsa 설정-------------
1. Host Server
$>ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
aa:bb:11:5a:6d:66:76:ee:e2:4c:9b:5d:3d:db:68:f5 root@$HOSTNAME
$>cd .ssh/
$>ls
$>scp id_rsa.pub $USER@$CLIENT_SERVER:.ssh/authorized_keys
2. Remote Server
$>chmod 755 ~/.ssh
$>chmod 644 .ssh/authorized_keys
1에서 2로 접속해보면 끝