메뉴 건너뛰기

조회 수 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

 

 

 

 

 

 


 

 

 


  1. 해외 IP차단

    Date2019.06.12 ByDDART Views2466
    Read More
  2. 서버사이 동기화하기 - rsync, mariadb replication

    Date2020.07.07 ByDDART Views2533
    Read More
  3. 로그지우기

    Date2021.11.04 ByDDART Views2718
    Read More
  4. 갑자기 WOL 이 동작안할때

    Date2020.11.07 ByDDART Views3058
    Read More
  5. msinfo 시스템정보 wmic cmd 명령

    Date2020.05.17 ByDDART Views3263
    Read More
  6. Visual Studio Code 에서 Autohotkey 설정

    Date2020.01.21 ByDDART Views3526
    Read More
  7. 우분투 16.04 FTP, Samba 등 가상디렉토리 추가

    Date2016.07.30 ByDDART Views3540
    Read More
  8. BATCH 문법

    Date2018.10.15 ByDDART Views3983
    Read More
  9. Windows 7, 8.1 에서 Windows 10으로 무료업그레이드하기

    Date2018.10.14 ByDDART Views4980
    Read More
  10. 우분투 16.04 ownCloud 9.1.0 설치

    Date2016.08.04 ByDDART Views5466
    Read More
  11. 우분투 16.04 MiniDLNA & BubbleUPnP Server 설치

    Date2016.07.29 ByDDART Views5543
    Read More
  12. 윈도우에서 우분투 MariaDB 10.5 로 SSL접속시 SEC_E_ALGORITHM_MISMATCH 오류

    Date2021.09.14 ByDDART Views6224
    Read More
  13. 우분투 16.04 서버 세팅

    Date2016.07.22 ByDDART Views7118
    Read More
  14. 윈도우 자동화관련 툴

    Date2019.06.01 ByDDART Views7185
    Read More
  15. 우분투 16.04 하드디스크 추가

    Date2016.07.28 ByDDART Views7236
    Read More
  16. MariaDB 외부접속시 ssl 사용법, 그리고 ssl 로 replication(동기화) 하기

    Date2020.07.11 ByDDART Views8083
    Read More
  17. crontab

    Date2017.09.08 ByDDART Views8370
    Read More
  18. 우분투 16.04 토렌트 서비스

    Date2016.07.26 ByDDART Views9983
    Read More
  19. 우분투 16.04 메일서버 설정

    Date2016.07.24 ByDDART Views10143
    Read More
  20. 우분투 16.04 Subversion - SVN서버, SVN+SSH 클라이언트

    Date2016.07.30 ByDDART Views10784
    Read More
Board Pagination Prev 1 2 3 ... 4 Next
/ 4