본문 바로가기
백엔드기술/개발환경

리눅스 서버 구축하기

by RevFactory 2014. 2. 9.

한글이 깨지면

export LANG=en_US.UTF-8


처음에 root 암호설정

sudo passwd root


최신상태로 

sudo apt-get update

sudo apt-get upgrade


vi 설치

sudo apt-get install vim


ssh설치

sudo apt-get install ssh

sudo /etc/init.d/ssh start


ftp설치

sudo apt-get install vsftpd

sudo vi /etc/vsftpd.conf

anonymous_enable=NO

local_enable=YES

write_enable=YES


sudo /etc/init.d/vsftpd start


열린 포트 확인

netstat -ntl



make가 되도록 설치

gcc설치

sudo apt-get install gcc

sudo apt-get install g++


make설치

sudo apt-get install make



구조

sudo mkdir /home/server

sudo ln -s /home/server server

sudo mkdir /server/program

sudo chown minho:minho /server/program

sudo mkdir /server/service

sudo chown minho:minho /server/service



httpd 설치

httpd 다운로드

wget http://apache.mirror.cdnetworks.com//httpd/httpd-2.2.26.tar.gz


httpd 압축해제

tar -xvf httpd-2.2.26.tar.gz


httpd 경로 지정하기

./configure --prefix=/server/program/httpd


make

make install


httpd 설정 변경

ServerRoot "/server/program/httpd"

ServerName ***.***.**

DocumentRoot "/server/service/htdocs"

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

#    Deny from all

</Directory>


java 설치

java 다운로드

wget --no-cookies --no-check-certificate  --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz"


java 압축해제

tar -xvzf jdk-7u51-linux-i586.tar.gz



이동 및 링크설정

mv jdk1.7.0_51/ /server/program/

ln -s /server/program/jdk1.7.0_51/ /server/program/java


PATH설정

sudo vi /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/server/program/java/bin"

JAVA_HOME=/server/program/java


PATH 적용

source /etc/environment


alternatives 설정

sudo update-alternatives --install "/usr/bin/java" "java" "/server/program/java/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/server/program/java/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/server/program/java/bin/javaws" 1


sudo update-alternatives --set java /server/program/java/bin/java

sudo update-alternatives --set javac /server/program/java/bin/javac

sudo update-alternatives --set javaws /server/program/java/bin/javaws



tomcat 설치

tomcat 다운로드

wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-7/v7.0.52/bin/apache-tomcat-7.0.52.tar.gz


압축해제

tar xvzf apache-tomcat-7.0.52.tar.gz


이동 및 링크설정

mv apache-tomcat-7.0.52 /server/program/

ln -s /server/program/apache-tomcat-7.0.52/ /server/program/tomcat




APACHE-TOMCAT 커넥터 설치

다운로드

wget http://apache.mirror.cdnetworks.com//tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz


압축해제

tar xvzf tomcat-connectors-1.2.37-src.tar.gz


설치

cd tomcat-connectors-1.2.37-src/native

./configure --with-apxs=/server/program/httpd/bin/apxs --prefix=/server/program/httpd

make

make install


설치 확인

ls /server/program/httpd/modules/mod_jk.so


연결하기

httpd.conf에 아래 내용 추가

LoadModule jk_module modules/mod_jk.so

<IfModule jk_module>

        JkWorkersFile    conf/workers.properties

        JkLogFile        logs/mod_jk.log

        JkLogLevel       info

        JKMount /docs worker1

        JKMount /docs/* worker1

</IfModule>


// 테스트로 tomcat의 docs 를 연결


worker.properties 생성 후 아래 내용 추가


worker.tomcat1.host=localhost

worker.tomcat1.port=8009

worker.tomcat1.type=ajp13

worker.tomcat1.connection_pool_size=100


worker.list=worker1

worker.worker1.type=lb

worker.worker1.balance_workers=tomcat1

worker.worker1.method=B





samba

samba를 설치해서 리눅스내 파일들을 윈도우에서 공유하여 사용할 수 있게 한다


패키지 설치

sudo apt-get install samba smbfs


cd /home

sudo mkdir /home/.conf


password설정

sudo smbpasswd -a [접속할 id]


설정파일 설정

cd /etc/samba

sudo cp smb.conf /home/.conf

sudo mv smb.conf smb.conf.backup

sudo ln -s /home/.conf/smb.conf smb.conf

sudo vi /home/.conf/smb.conf

아래내용 추가

[home]

        comment = rev's home

        path = /home

        writable = yes

        guest ok = no

        create mask = 0644

        directory mask = 0755 

hosts allow = 192.168.0.2 unix charset = utf-8 dos charset = 949 display charset = utf-8


대괄호 안에 이름으로 접근한다


삼바 재시작

sudo service smbd restart


윈도우

내PC -> 네트워크 드라이브 -> \\[서버ip]\home