메뉴 건너뛰기

조회 수 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. No Image 07Jul
    by DDART
    2020/07/07 by DDART
    Views 2533 

    서버사이 동기화하기 - rsync, mariadb replication

  2. No Image 17May
    by DDART
    2020/05/17 by DDART
    Views 3263 

    msinfo 시스템정보 wmic cmd 명령

  3. No Image 21Jan
    by DDART
    2020/01/21 by DDART
    Views 3526 

    Visual Studio Code 에서 Autohotkey 설정

  4. No Image 21Dec
    by DDART
    2019/12/21 by DDART
    Views 1577 

    우분투 19.04, 19.10, 20.04 으로 업그레이드 하기

  5. No Image 08Sep
    by DDART
    2019/09/08 by DDART
    Views 2102 

    윈도우 10에서 구글 어시스턴트 명령

  6. No Image 12Jun
    by DDART
    2019/06/12 by DDART
    Views 2466 

    해외 IP차단

  7. No Image 11Jun
    by DDART
    2019/06/11 by DDART
    Views 313589 

    Fail2Ban 설정하기

  8. No Image 01Jun
    by DDART
    2019/06/01 by DDART
    Views 7185 

    윈도우 자동화관련 툴

  9. No Image 31Oct
    by DDART
    2018/10/31 by DDART
    Views 14044 

    PHP로 WOL Magic Packet 보내기

  10. No Image 15Oct
    by DDART
    2018/10/15 by DDART
    Views 3983 

    BATCH 문법

  11. No Image 15Oct
    by DDART
    2018/10/15 by DDART
    Views 1943 

    우분투 16.04 에서 18.04 로 업그레이드하기

  12. No Image 14Oct
    by DDART
    2018/10/14 by DDART
    Views 4980 

    Windows 7, 8.1 에서 Windows 10으로 무료업그레이드하기

  13. No Image 11Dec
    by DDART
    2017/12/11 by DDART
    Views 2103 

    vsftpd 설정

  14. No Image 08Sep
    by DDART
    2017/09/08 by DDART
    Views 8370 

    crontab

  15. VBA Project 패스워드 보호 제거하기

  16. No Image 04Aug
    by DDART
    2016/08/04 by DDART
    Views 5466 

    우분투 16.04 ownCloud 9.1.0 설치

  17. No Image 30Jul
    by DDART
    2016/07/30 by DDART
    Views 10784 

    우분투 16.04 Subversion - SVN서버, SVN+SSH 클라이언트

  18. No Image 30Jul
    by DDART
    2016/07/30 by DDART
    Views 3540 

    우분투 16.04 FTP, Samba 등 가상디렉토리 추가

  19. No Image 29Jul
    by DDART
    2016/07/29 by DDART
    Views 5543 

    우분투 16.04 MiniDLNA & BubbleUPnP Server 설치

  20. No Image 28Jul
    by DDART
    2016/07/28 by DDART
    Views 7236 

    우분투 16.04 하드디스크 추가

Board Pagination Prev 1 2 3 ... 4 Next
/ 4