메뉴 건너뛰기

조회 수 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
번호 제목 글쓴이 날짜 조회 수
42 서버사이 동기화하기 - rsync, mariadb replication DDART 2020.07.07 2528
41 msinfo 시스템정보 wmic cmd 명령 DDART 2020.05.17 3260
40 Visual Studio Code 에서 Autohotkey 설정 DDART 2020.01.21 3518
39 우분투 19.04, 19.10, 20.04 으로 업그레이드 하기 DDART 2019.12.21 1577
38 윈도우 10에서 구글 어시스턴트 명령 DDART 2019.09.08 2102
37 해외 IP차단 DDART 2019.06.12 2465
36 Fail2Ban 설정하기 DDART 2019.06.11 313462
35 윈도우 자동화관련 툴 DDART 2019.06.01 7185
34 PHP로 WOL Magic Packet 보내기 DDART 2018.10.31 14042
33 BATCH 문법 DDART 2018.10.15 3983
32 우분투 16.04 에서 18.04 로 업그레이드하기 DDART 2018.10.15 1943
31 Windows 7, 8.1 에서 Windows 10으로 무료업그레이드하기 DDART 2018.10.14 4975
30 vsftpd 설정 DDART 2017.12.11 2103
29 crontab DDART 2017.09.08 8358
28 VBA Project 패스워드 보호 제거하기 3 DDART 2016.09.21 25520
27 우분투 16.04 ownCloud 9.1.0 설치 DDART 2016.08.04 5466
26 우분투 16.04 Subversion - SVN서버, SVN+SSH 클라이언트 DDART 2016.07.30 10780
25 우분투 16.04 FTP, Samba 등 가상디렉토리 추가 DDART 2016.07.30 3540
24 우분투 16.04 MiniDLNA & BubbleUPnP Server 설치 DDART 2016.07.29 5538
23 우분투 16.04 하드디스크 추가 DDART 2016.07.28 7236
Board Pagination Prev 1 2 3 ... 4 Next
/ 4