ubuntu 18.04 LAMP Stack 설치
저장소 변경 및 시스템 업데이트
편의상 sudo -i 를 사용 합니다.
root@test:~# vi /etc/apt/sources.list :%s/archive.ubuntu.com/mirror.kakao.com/g root@test:~# apt update && apt upgrade root@test:~# init 6
apache 설치
root@test:~# apt install -y apache2 apache2-utils root@test:~# systemctl status apache2 ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: active (running) since Thu 2019-10-03 04:45:02 UTC; 12s ago Main PID: 1864 (apache2) Tasks: 55 (limit: 4632) CGroup: /system.slice/apache2.service ├─1864 /usr/sbin/apache2 -k start ├─1867 /usr/sbin/apache2 -k start └─1868 /usr/sbin/apache2 -k start Oct 03 04:45:02 test systemd[1]: Starting The Apache HTTP Server... Oct 03 04:45:02 test apachectl[1838]: AH00558: apache2: Could not reliably determine the server's fully qualif Oct 03 04:45:02 test systemd[1]: Started The Apache HTTP Server. root@test:~# root@test:~# chown -R www-data:www-data /var/www/html/ 설치된 apache 버전 root@test:~# dpkg -l |grep apache2 ii apache2 2.4.29-1ubuntu4.11 amd64 Apache HTTP Server ii apache2-bin 2.4.29-1ubuntu4.11 amd64 Apache HTTP Server (modules and other binary files) ii apache2-data 2.4.29-1ubuntu4.11 all Apache HTTP Server (common files) ii apache2-utils 2.4.29-1ubuntu4.11 amd64 Apache HTTP Server (utility programs for web servers) root@test:~#
web-site 확인
ifconfig 로 ip 확인후 http://ip-address 로 접속을 합니다.
root@test:~# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::20c:29ff:fe21:fa45 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:21:fa:45 txqueuelen 1000 (Ethernet) RX packets 1530 bytes 1822479 (1.8 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 444 bytes 63555 (63.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 110 bytes 8368 (8.3 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 110 bytes 8368 (8.3 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@test:~#
mariadb 설치
root@test:~# apt install -y mariadb-server mariadb-client mariadb 버전확인 root@test:~# dpkg -l |grep mariadb ii mariadb-client 1:10.1.41-0ubuntu0.18.04.1 all MariaDB database client (metapackage depending on the latest version) ii mariadb-client-10.1 1:10.1.41-0ubuntu0.18.04.1 amd64 MariaDB database client binaries ii mariadb-client-core-10.1 1:10.1.41-0ubuntu0.18.04.1 amd64 MariaDB database core client binaries ii mariadb-common 1:10.1.41-0ubuntu0.18.04.1 all MariaDB common metapackage ii mariadb-server 1:10.1.41-0ubuntu0.18.04.1 all MariaDB database server (metapackage depending on the latest version) ii mariadb-server-10.1 1:10.1.41-0ubuntu0.18.04.1 amd64 MariaDB database server binaries ii mariadb-server-core-10.1 1:10.1.41-0ubuntu0.18.04.1 amd64 MariaDB database core server files root@test:~# 기본적으로 enable 되어 있습니다. root@test:~# systemctl status mariadb ● mariadb.service - MariaDB 10.1.41 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2019-10-03 04:49:51 UTC; 50s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 3052 (mysqld) Status: "Taking your SQL requests now..." Tasks: 27 (limit: 4632) CGroup: /system.slice/mariadb.service └─3052 /usr/sbin/mysqld Oct 03 04:49:52 test /etc/mysql/debian-start[3088]: mysql Oct 03 04:49:52 test /etc/mysql/debian-start[3088]: performance_schema Oct 03 04:49:52 test /etc/mysql/debian-start[3088]: Phase 6/7: Checking and upgrading tables Oct 03 04:49:52 test /etc/mysql/debian-start[3088]: Processing databases Oct 03 04:49:52 test /etc/mysql/debian-start[3088]: information_schema Oct 03 04:49:52 test /etc/mysql/debian-start[3088]: performance_schema Oct 03 04:49:52 test /etc/mysql/debian-start[3088]: Phase 7/7: Running 'FLUSH PRIVILEGES' Oct 03 04:49:52 test /etc/mysql/debian-start[3088]: OK Oct 03 04:49:52 test /etc/mysql/debian-start[3155]: Checking for insecure root accounts. Oct 03 04:49:52 test /etc/mysql/debian-start[3159]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables root@test:~#
mariadb root password 설정및 기본 설정스크립트 실행
root@test:~# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB 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? [Y/n] 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? [Y/n] y ... Success! By default, MariaDB 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? [Y/n] 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? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! root@test:~# 설정한 root 패스워드로 로그인합니다. root@test:~# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 49 Server version: 10.1.41-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> status; -------------- mysql Ver 15.1 Distrib 10.1.41-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 Connection id: 49 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 10.1.41-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04 Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/run/mysqld/mysqld.sock Uptime: 2 min 24 sec Threads: 1 Questions: 447 Slow queries: 0 Opens: 167 Flush tables: 1 Open tables: 30 Queries per second avg: 3.104 -------------- MariaDB [(none)]> quit; Bye root@test:~#
php 7.2 설치 및 php7.2 module 활성화
phpinfo 코드를 생성 합니다.
root@test:~# apt install -y php7.2 libapache2-mod-php7.2 php7.2-mysql php-common php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline root@test:~# a2enmod php7.2 root@test:~# systemctl restart apache2 root@test:~# vi /var/www/html/info.php <?php phpinfo(); ?>
php-fpm 설정
root@test:~# a2dismod php7.2 root@test:~# apt install -y php7.2-fpm root@test:~# a2enmod proxy_fcgi setenvif root@test:~# a2enconf php7.2-fpm root@test:~# systemctl restart apache2
php-fpm 설정전
설정후
Comments