서버 환경
- 서버 리전 : JP (Tokyo)
- 운영체제 : Ubuntu 18.04 x64
- 1 vCore, 1GB RAM
오늘은 우분투에 웹서버를 설치해보자.
우선 미러사이트들을 최신으로 패치해주기 위해 다음 커맨드를 실행해준다.
$ sudo apt-get update
$ sudo apt-get upgrade
위의 명령어로 패치를 완료했다면, 본격적으로 아파치를 설치해보자.
다음 커맨드를 실행하면 디스크 공간을 사용한다는 질문이 나오는데, Y를 입력하여 허용해주자.
$ sudo apt-get install apache2
이제 이 서버의 외부 아이피로 접속하면 Apache2 Debian Default Page 가 뜰것이다.
이 페이지를 지우거나 수정하고 싶다면 /var/www/html 디렉토리에서 작업하면 된다.
아파치를 설치해주었으니 이제 PHP를 설치해주자.
$ sudo apt-get install php libapache2-mod-php -y
아파치와 PHP를 설치하였으니 mySQL을 설치해보자.
$ sudo apt install mysql-server
위 명령어로 설치가 완료되었다면 다음 명령어를 통해 설정을 하자.
$ sudo mysql_secure_installation
root@vultr:~# sudo mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 : [보안레벨 설정]
Please set the password for root here.
New password: [DB관리자 비밀번호]
Re-enter new password: [DB관리자 비밀번호 재입력]
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
위의 과정들을 모두 마쳤다면 해당 리눅스는 완벽한 웹서버가 된 것이다.
'서버 > 일반' 카테고리의 다른 글
우분투에서 CTFd를 오류없이 설치하는 법 (9) | 2019.01.01 |
---|