메뉴 건너뛰기

조회 수 7118 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

루트 비번 설정 

 

sudo passwd root
su

 

apt 패키지 DB 업데이트 및 시스템 업그레이드

 

apt-get update
apt-get upgrade

 

네트워크 시간 맞추기

 

apt-get install ntp ntpdate
date

 

타임존 변경

 

timedatectl set-timezone 'Asia/Seoul'

 

 

호스트네임 변경

 

hostnamectl set-hostname server

 

 

/etc/hosts 에 로컬주소 추가

127.0.0.1   localhost
127.0.0.1   server

 

 

 

 

LAMP 설치 (Linux Apache, MySQL/MariaDB, PHP)

 

1. Apache

 

설치

 

apt-get install apache2
apache2 -v

 

모듈 enable, disable

 

a2enmod deflate expires headers rewrite ssl
a2ensite default-ssl
a2dismod -f autoindex

 

모듈 설치 multiuser module

 

apt-get install libapache2-mpm-itk

 

보안설정

 

 vi /etc/apache2/apache2.conf

# deny file, folder start with dot
<DirectoryMatch "^\.|\/\.">
        Require all denied
</DirectoryMatch>
# 이 부분 추가 
# deny (log file, binary, certificate, shell script, sql dump file) access.
<FilesMatch "\.(log|binary|pem|enc|crt|conf|sql|sh)$">
        Require all denied
</FilesMatch>
 
# deny access.
<FilesMatch "(pp_cli|pp_cli_x64|LICENSE|README\.md|composer\.json|COPYRIGHT|CONTRIBUTING\.md|LICENSE\.txt)$">
        Require all denied
</FilesMatch>
 

 

vi /etc/apache2/conf-available/charset.conf

문자셋을 UTF-8로 바꾸고

vi /etc/apache2/conf-available/security.conf

추가보안설정한다.

 

 

2. PHP

 

설치

 

apt-get install libapache2-mod-php7.0
php -v

 

모듈

 

apt-get install php-mcrypt php-mbstring php-gd php-curl php-mysql php-cli php-apcu php7.0-xml

 

 

php.ini 수정

 

vi /etc/php/7.0/apache2/php.ini
vi /etc/php/7.0/cli/php.ini
 

date.timezone = Asia/Seoul

 

 

3. Mariadb (mysql GPL 버전, 사용법 동일)

 

설치

 

apt-get install mariadb-server

 

 

DB초기화

 

/usr/bin/mysql_secure_installation

#

 

사용자 추가

 

mysql> use mysql;
mysql> create user 사용자ID;
mysql> create user 사용자ID@localhost identified by '비밀번호';
mysql> grant all privileges on db이름.* to 사용자ID@localhost identified by '비밀번호';
mysql> flush privileges;

 

 

home 권한변경 및 웹사이트 www 디렉토리 지정

 

chmod 711 /home
chmod -R 700 /home/*

 

일반 유저계정으로

 

mkdir /home/사용자/www

 

virtual host 설정은

/etc/apache2/sites-available 디렉토리에 각각의 도메인명이름으로 conf파일을 카피등으로 생성한후 수정하고

 

<VirtualHost *:80>
    ServerName ddart.net
    DocumentRoot /home/ddart/www/ddart.net
    <Directory /home/ddart/www/ddart.net>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>


    AssignUserID ddart ddart

    ErrorLog ${APACHE_LOG_DIR}/ddart.net-error.log
    CustomLog ${APACHE_LOG_DIR}/ddart.net-access.log combined
</VirtualHost>

 

 

a2ensite 명령을 주면 sites-enabled 디렉토리에 심볼릭 링크가 걸려 설정파일이 적용된다.

 

a2ensite 도메인명

 

 


FTP 서버 설치

 

apt-get install vsftpd

 

vi /etc/vsftpd.conf

 

# 주석제거
wirte_enables=YES 

 

서비스 재시작

 

service vsftpd restart

 

 

Samba 서버 설치

 

설치

 

apt-get install samba samba-common cifs-utils

 

 

설정

 

 vi /etc/samba/smb.conf

#======================= Share Definitions =======================

[ddart]
commnet = ddart's home
path = /home/ddart
valid users = ddart
writable = yes
create mask = 0644
directory mask = 0755

 

삼바 비번 설정 및 재시작

 

smbpasswd -a ddart
service smbd restart

 

 

웹관련 파일들 ftp나 삼바 네크워크 공유로 전송

 

DB 백업파일로 DB 복구

 

백업

 

mysqldump -u아이디 -p DB명 > 백업파일.sql

 

복구

 

mysql -u아이디 -p DB명 < 백업파일.sql

 

fail2ban 설치

 

설치

 

apt-get install fail2ban

 

 

설정

 

vi /etc/fail2ban/jail.conf

 

# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1/8 192.168.0.1/16 관리PCIP/24

# External command that will take an tagged arguments to ignore, e.g. <ip>,
# and return true if the IP is to be ignored. False otherwise.
#
# ignorecommand = /path/to/command <ip>
ignorecommand =

# "bantime" is the number of seconds that a host is banned.
bantime  = 86400

 

 

웹서비스 재시작

 

service apache2 restart

 

 

 

 

 

 


 

 

 


List of Articles
번호 제목 글쓴이 날짜 조회 수
62 MYSQL 덤프파일 입력 DDART 2013.07.08 22665
61 우분투 파일시스템 이미지파일 만들기 DDART 2013.07.08 21465
60 갤럭시U 테그라크커널 DDART 2013.07.08 20788
59 아파치2 rewrite mod enable DDART 2013.07.08 21301
58 Ubuntu 12.04 Desktop 초기 설치 DDART 2013.07.08 22547
57 chrooted ubuntu 초기 설정 DDART 2013.07.08 21297
56 설치된 package 정보보기 DDART 2013.07.08 22180
55 갤럭시U 삭제가능한 기본어플 DDART 2013.07.08 22521
54 작업순서 DDART 2013.07.08 21164
53 메일서버 설정 DDART 2013.07.08 21698
52 KimsQ RB IIS + PM 설치문제 해결 DDART 2013.07.08 22592
51 Ubuntu Mail Server 구축하기 DDART 2013.07.08 22481
50 Javascript reformatter DDART 2013.07.10 22166
49 usb download tool - 32bit 운영체제에서 64bit 운영체제 usb 부팅디스크 만들기 DDART 2013.08.07 25658
48 Windows 8 시작버튼 달기 DDART 2013.10.16 20655
47 윈도우 메일서버구축 DDART 2013.10.17 21532
46 저전력 홈서버 구축 DDART 2013.10.17 22978
45 hMailServer 국가별 접속허용, 차단법 DDART 2013.11.20 21213
44 우분투 16.04 데스크탑 - CLI 모드로 전환 및 부팅하기 관리자 2016.07.20 38630
» 우분투 16.04 서버 세팅 DDART 2016.07.22 7118
Board Pagination Prev 1 2 3 ... 4 Next
/ 4