김보안의 블로깅
  • 🏠 Home
  • 📚 Project
    • Blockchain
      • 🎦 PickMe
      • 🎦 IoTC
      • 🎦 Blackchain
      • 📃 Gemology
      • 🎦 PickMe
      • 🎦 PickMe
    • AI
      • 👋 A.I. Dream Reader
      • 🎦 A.I. Dream Reader
    • Security
      • 🎦 SNAC
    • Education
      • 🎦 Smart Lecture
  • 🤸‍♂ Hobby
    • Music
      • Violin
      • Guitar
      • Piano
      • Drum
    • Flower
      • Flower Certificate
    • Sport
      • Ski
      • Skateboard
      • Golf
      • Boxing

2013년 9월 1일 일요일

[CentOS 6.x] 각종 서버 설치하기

 SecureKim     오전 1:54     서버 설치, 설정, 설치, 파일공유 설치, apache 설치, Centos, install, mysql, Nginx 설치, Node 설치, PHP 설치, Predis 설치, Redis 설치, samba 설치     No comments   

**기본

yum -y update
yum -y groupinstall "Development Tools"

**NginX


#wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
#rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
#yum install nginx
#service nginx start

Nginx는 /etc/nginx/nginx.conf 요 파일이 /etc/nginx/conf.d/default.conf 파일을 인클루드 하고 있습니다.
두 파일은 혹시나 모르니 cp 명령어로 백업 해놓으시고

worker_processes 부분에는 하드웨어 코어 개수만큼 숫자를 적어 줍니다.

#vi /etc/nginx/nginx.conf

user              nginx;
worker_processes  4;
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  30;
    server {
        listen       80;
        server_name  _;
        location / {
            root   /usr/share/nginx/html;
            index  index.php index.html index.htm;
        }
        error_page  404              /404.html;
        location = /404.html {
            root   /usr/share/nginx/html;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
        location ~* \.php$ {
            root           /usr/share/nginx/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO $fastcgi_script_name;
            include        fastcgi_params;
        }
    }
    include /etc/nginx/conf.d/*.conf;
}



#vi /etc/nginx/conf.d/default.conf
server {
    listen       80;
    server_name  _;
    location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    location ~ \.php$ {
        root           /usr/share/nginx/html;
        try_files $uri =404;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

service nginx restart 

**Apache 

전 리버스 프록시를 이용해 PHP 요청은 아파치가 처리하도록 했기 때문에 설치했는데
Nginx만 쓰면 굳이 설치할 필요는 없습니다.

#yum -y install httpd

구동하는 포트넘버가 80으로 되어있는데 Nginx랑 겹치니까 다른걸로 바꿔주면 됩니다.

service httpd restart


**Mysql

#yum -y install mysql mysql-server
#mysqladmin -u root password 비밀번호

패스워드 설정해줍니다.

참고로 자료 백업 및 복구할 때(전체)
백업 : mysqldump -u root -p --all-databases > 파일명.sql
복구 : mysql -u root -p < 파일명.sql

특정 테이블만 하는거면 저기 -p 뒤에 테이블 명 쓰면 됩니다.

그리고 처음에 원격접속 허용하려면 service mysqld start 로 시작한 후

 mysql -u root -p 로 로그인하고,

use mysql; 한 다음 host 컬럼을 %로 바꾸면 원격으로도 접속이 가능합니다.

UPDATE `mysql`.`user`
SET `Host`='%'
WHERE `Host`='localhost' AND `User`='root';

service mysqld restart


**REDIS

#cd /usr/local/src
#wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz
#tar xvfz redis-2.6.14.tar.gz
#cd redis-2.6.14
#make -j4 && make install  -j4

redis-server&


**Node

#yum -y update
#yum -y groupinstall "Development Tools"

#wget http://nodejs.org/dist/v0.10.17/node-v0.10.17.tar.gz
#tar zxf node-v0.10.17.tar.gz
#cd node-v0.10.17
#./configure
#make
#make install

모듈들 설치는

#npm -g install 설치할모듈

실행은

#node 실행할파일

**PHP

#yum -y install
php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-fpm

php.ini 파일 수정해서
short_open_tag = On 해줍니다.

우린 PHP-FPM 사용할거니까

service php-fpm restart

*Predis (PHP 와 Redis 연결)

#pear channel-discover pear.nrk.io
#pear install nrk/Predis



**Samba

이건 다 아시겠지만 윈도우처럼 파일 공유하는 서비스입니다.

yum install samba
smbpasswd -a 사용자명      // 패스워드설정
service smb start

아무리 권한을 추가해도 권한 문제가 생긴다면

vi /etc/selinux/config
Set
//SELINUX=enforcing 이걸
SELINUX=disabled //요렇게 고치면 됩니다.

vi /etc/samba/smb.conf 
를 열어서 여러가지 수정을 해줍니다.

server string = Server name
hosts allow = lo eth0 11.22.33.   // 11.22.33 대역 접속 허용 설정
[share]
    comment = hi
    path = /usr/share/nginx
    writable = yes
    valid user = by

이것은 by라는 사용자에게 /usr/share/nginx 디렉토리를 공유할 수 있도록 한 것입니다.

권한 문제가 있다면 user의 디렉토리와 /etc/passwd 의 디렉토리를 같게 해주고

chmod 755 등으로 해당 디렉토리에 권한을 줘봅니다.

/sbin/service smb restart 


***6시간짜리 팁

이렇게 하고 Nginx와 PHP-FPM 이 연동이 안됬습니다.

php -v , php-fpm -v 로 버젼을 확인해보니 5.3

혹시나해서 5.5로 업데이트 해보았습니다.

#rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

#yum --enablerepo=remi,remi-test install httpd mysql mysql-server php php-common

#yum --enablerepo=remi,remi-test install php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo

그래도 안되서 권한부터 시작해서 온갖 걸 다 해봤습니다.

/var/log/nginx/error.log 파일을 열어보면 에러로그들이 있죠

계속해서 살펴보던 중 시스템 시각과 현재 시각이 맞지 않다는 것을 알게 되었고

시간이나 맞춰야지 하고

rdate -s time.bora.net

...

갑자기 잘됨

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ???????????????????



  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
이메일로 전송BlogThis!X에 공유Facebook에서 공유
최근 게시물 이전 게시물 홈

0 개의 댓글:

댓글 쓰기

페이지

  • 홈
  • Hobby

Categories

  • AI
  • AWS
  • Blockchain
  • Hardware
  • Javascript
  • Node.js
  • Plasma
  • Security
  • Study
  • Video
  • android
  • mysql
  • review
  • windows

Popular Posts

  • 다빈치리졸브로 영상의 음성 보정 (잡음 노이즈 없애기)
      잡음 없애는 방법 1. 음악 쪽 들어가서 음악에서 소스 우클릭 - Normalize Audio Levels 2. 우측의 Mixer에서 Dynamics 더블클릭, Effects아래 +누르고 Metering에 Meter 그럼 아래처럼 나오는데  Gat...
  • 블루투스 BLE 보안 모드와 보안 레벨 (BLE SECURITY MODE and SECURITY LEVEL)
      BLE에서 무슨 모드와 무슨 레벨을 사용해야 가장 안전할까? (글 맨 밑에 답 있음) 블루투스는 워낙 표준이 다양하고 버전따라서 달라서 다들 다른 이야기를 하는 것 같다. BLE와 BT는 전혀 별개의 표준인데 같은거라고 이야기하는 사람도 있고 특히...
  • 회사 프록시와 인증서에 고통받는 그대를 위한 글 (Bash, Gradle, Python, wget, nodejs(npm), apt-get, cURL, git, yarn, androidStudio)
    대기업에 입사하면 장단점이 있는데, 단점 중에 하나가 회사에서 프록시를 사용하여 트래픽 감시를 하므로 프록시 설정을 해주어야 한다는 점 입니다. 특히, 회사에서는 https 트래픽도 감시를 하므로 인증서도 설정해 주어야 합니다. 그런데 문...

Blog Archive

  • ►  2024 (2)
    • ►  11월 (2)
  • ►  2023 (2)
    • ►  10월 (1)
    • ►  1월 (1)
  • ►  2022 (10)
    • ►  12월 (1)
    • ►  11월 (3)
    • ►  9월 (1)
    • ►  8월 (1)
    • ►  6월 (2)
    • ►  3월 (2)
  • ►  2021 (9)
    • ►  12월 (3)
    • ►  11월 (1)
    • ►  6월 (1)
    • ►  5월 (2)
    • ►  4월 (2)
  • ►  2020 (12)
    • ►  10월 (1)
    • ►  9월 (2)
    • ►  7월 (1)
    • ►  6월 (1)
    • ►  5월 (5)
    • ►  4월 (1)
    • ►  2월 (1)
  • ►  2019 (14)
    • ►  10월 (2)
    • ►  7월 (1)
    • ►  3월 (4)
    • ►  2월 (2)
    • ►  1월 (5)
  • ►  2018 (14)
    • ►  12월 (2)
    • ►  11월 (4)
    • ►  10월 (1)
    • ►  8월 (2)
    • ►  5월 (4)
    • ►  1월 (1)
  • ►  2017 (12)
    • ►  10월 (2)
    • ►  9월 (9)
    • ►  5월 (1)
  • ►  2016 (8)
    • ►  10월 (2)
    • ►  8월 (1)
    • ►  6월 (1)
    • ►  1월 (4)
  • ►  2015 (6)
    • ►  12월 (3)
    • ►  10월 (1)
    • ►  6월 (1)
    • ►  5월 (1)
  • ►  2014 (10)
    • ►  11월 (1)
    • ►  9월 (1)
    • ►  7월 (1)
    • ►  6월 (1)
    • ►  5월 (3)
    • ►  4월 (1)
    • ►  3월 (2)
  • ▼  2013 (28)
    • ►  12월 (3)
    • ►  11월 (6)
    • ►  10월 (6)
    • ▼  9월 (6)
      • Power Mockup!
      • [AWS] 아마존 웹 서비스 요금(Free-tier)
      • [AWS] 아마존 웹 서비스 시작하기
      • [UCrew] 나에게도 태블릿이 있다면...
      • [CentOS 6.x] 각종 서버 설치하기
      • [CentOS 6.x] 설치
    • ►  8월 (1)
    • ►  7월 (3)
    • ►  6월 (3)

구독

글
Atom
글
댓글
Atom
댓글

로드 중입니다...

각오

직접 해보지 않은 것은 포스팅 하지 않겠습니다.

Copyright © 김보안의 블로깅 | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com | Distributed By Gooyaabi Templates