Install Apache, MySQL, PHP7 as a Web Server on Ubuntu Server 16.04

Membangun webserver menggunakan linux, kenapa saya memilih Linux? Bukan berarti saya tidak bisa membangun webserver berbasis Windows OS, namun dikarenakan Linux itu opensource dan gratis, namun ada juga linux yang berbayar yaitu RedHat.

Sudah gratis dan performancenya yang luar biasa, itulah kenapa saya jatuh cinta kepada linux :p.

Ok, pastikan ubuntu server 16.04 sudah terinstall dengan benar dan terhubung ke internet :v

#Install Apache

root@ubuntu:~# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 libperl5.22 perl
perl-modules-5.22 rename ssl-cert
Suggested packages:
www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom
perl-doc libterm-readline-gnu-perl | libterm-readline-perl-perl make
openssl-blacklist
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 libperl5.22 perl
perl-modules-5.22 rename ssl-cert
0 upgraded, 14 newly installed, 0 to remove and 73 not upgraded.
Need to get 7,815 kB of archives.
After this operation, 45.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 perl-modules-5.22 all 5.22.1-9 [2,641 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libperl5.22 amd64 5.22.1-9 [3,371 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 perl amd64 5.22.1-9 [237 kB]
64% [3 perl 0 B/237 kB 0%] 267 kB/s 6srGet:4 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libapr1 amd64 1.5.2-3 [86.0 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1 amd64 1.5.4-1build1 [77.1 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-1build1 [10.6 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaprutil1-ldap amd64 1.5.4-1build1 [8,720 B]
Get:8 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liblua5.1-0 amd64 5.1.5-8ubuntu1 [102 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-bin amd64 2.4.18-2ubuntu3.1 [923 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-utils amd64 2.4.18-2ubuntu3.1 [81.3 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-data all 2.4.18-2ubuntu3.1 [162 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2 amd64 2.4.18-2ubuntu3.1 [86.7 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 rename all 0.20-4 [12.0 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 ssl-cert all 1.0.37 [16.9 kB]
Fetched 7,815 kB in 31s (251 kB/s)
Preconfiguring packages ...
Selecting previously unselected package perl-modules-5.22.
(Reading database ... 52869 files and directories currently installed.)
Preparing to unpack .../perl-modules-5.22_5.22.1-9_all.deb ...
Unpacking perl-modules-5.22 (5.22.1-9) ...
Selecting previously unselected package libperl5.22:amd64.
Preparing to unpack .../libperl5.22_5.22.1-9_amd64.deb ...
Unpacking libperl5.22:amd64 (5.22.1-9) ...
Selecting previously unselected package perl.
Preparing to unpack .../perl_5.22.1-9_amd64.deb ...
Unpacking perl (5.22.1-9) ...
Selecting previously unselected package libapr1:amd64.
Preparing to unpack .../libapr1_1.5.2-3_amd64.deb ...
Unpacking libapr1:amd64 (1.5.2-3) ...
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack .../libaprutil1_1.5.4-1build1_amd64.deb ...
Unpacking libaprutil1:amd64 (1.5.4-1build1) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.
Preparing to unpack .../libaprutil1-dbd-sqlite3_1.5.4-1build1_amd64.deb ...
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) ...
Selecting previously unselected package libaprutil1-ldap:amd64.
Preparing to unpack .../libaprutil1-ldap_1.5.4-1build1_amd64.deb ...
Unpacking libaprutil1-ldap:amd64 (1.5.4-1build1) ...
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack .../liblua5.1-0_5.1.5-8ubuntu1_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8ubuntu1) ...
Selecting previously unselected package apache2-bin.
Preparing to unpack .../apache2-bin_2.4.18-2ubuntu3.1_amd64.deb ...
Unpacking apache2-bin (2.4.18-2ubuntu3.1) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../apache2-utils_2.4.18-2ubuntu3.1_amd64.deb ...
Unpacking apache2-utils (2.4.18-2ubuntu3.1) ...
Selecting previously unselected package apache2-data.
Preparing to unpack .../apache2-data_2.4.18-2ubuntu3.1_all.deb ...
Unpacking apache2-data (2.4.18-2ubuntu3.1) ...
Selecting previously unselected package apache2.
Preparing to unpack .../apache2_2.4.18-2ubuntu3.1_amd64.deb ...
Unpacking apache2 (2.4.18-2ubuntu3.1) ...
Selecting previously unselected package rename.
Preparing to unpack .../archives/rename_0.20-4_all.deb ...
Unpacking rename (0.20-4) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../ssl-cert_1.0.37_all.deb ...
Unpacking ssl-cert (1.0.37) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Setting up perl-modules-5.22 (5.22.1-9) ...
Setting up libperl5.22:amd64 (5.22.1-9) ...
Setting up perl (5.22.1-9) ...
update-alternatives: using /usr/bin/prename to provide /usr/bin/rename (rename) in auto mode
Setting up libapr1:amd64 (1.5.2-3) ...
Setting up libaprutil1:amd64 (1.5.4-1build1) ...
Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.4-1build1) ...
Setting up libaprutil1-ldap:amd64 (1.5.4-1build1) ...
Setting up liblua5.1-0:amd64 (5.1.5-8ubuntu1) ...
Setting up apache2-bin (2.4.18-2ubuntu3.1) ...
Setting up apache2-utils (2.4.18-2ubuntu3.1) ...
Setting up apache2-data (2.4.18-2ubuntu3.1) ...
Setting up apache2 (2.4.18-2ubuntu3.1) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Setting up rename (0.20-4) ...
update-alternatives: using /usr/bin/file-rename to provide /usr/bin/rename (rename) in auto mode
Setting up ssl-cert (1.0.37) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...

Jika proses installasi sudah selesai, silahkan akses IP Server yang barusan andan install apache-nya

apache

Untuk memastikannya lagi silahkan check port 80 (http port) kalau sudah dalam mode listening dengan perintah berikut:

root@ubuntu:~# netstat -tulpn | grep 80
tcp6       0       0        :::80           :::*         LISTEN              9250/apache2

Ok, apache nya sudah berhasil terinstall, next:

#Install MySQL Server

root@ubuntu:~# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
liblwp-mediatypes-perl libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common
mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx tinyca
The following NEW packages will be installed:
libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
liblwp-mediatypes-perl libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common
mysql-server mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 21 newly installed, 0 to remove and 73 not upgraded.
Need to get 18.8 MB of archives.
After this operation, 162 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libevent-core-2.0-5 amd64 2.0.21-stable-2 [69.4 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.16-0ubuntu0.16.04.1 [15.0 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libaio1 amd64 0.3.110-2 [6,356 B]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-core-5.7 amd64 5.7.16-0ubuntu0.16.04.1 [6,365 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-5.7 amd64 5.7.16-0ubuntu0.16.04.1 [1,739 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-core-5.7 amd64 5.7.16-0ubuntu0.16.04.1 [7,395 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-5.7 amd64 5.7.16-0ubuntu0.16.04.1 [2,597 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-tagset-perl all 3.20-2 [13.5 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liburi-perl all 1.71-1 [76.9 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-parser-perl amd64 3.72-1 [86.1 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libcgi-pm-perl all 4.26-1 [185 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libfcgi-perl amd64 0.77-1build1 [32.3 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libcgi-fast-perl all 1:2.10-1 [10.2 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libencode-locale-perl all 1.05-1 [12.3 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-template-perl all 2.95-2 [60.4 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libhttp-date-perl all 6.02-1 [10.4 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libio-html-perl all 1.001-1 [14.9 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liblwp-mediatypes-perl all 6.02-1 [21.7 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libhttp-message-perl all 6.11-1 [74.3 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server all 5.7.16-0ubuntu0.16.04.1 [10.1 kB]
Fetched 18.8 MB in 13s (1,356 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libevent-core-2.0-5:amd64.
(Reading database ... 55338 files and directories currently installed.)
Preparing to unpack .../libevent-core-2.0-5_2.0.21-stable-2_amd64.deb ...
Unpacking libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.7.16-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-common (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../libaio1_0.3.110-2_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-2) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.16-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 55507 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.16-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../libhtml-tagset-perl_3.20-2_all.deb ...
Unpacking libhtml-tagset-perl (3.20-2) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../liburi-perl_1.71-1_all.deb ...
Unpacking liburi-perl (1.71-1) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../libhtml-parser-perl_3.72-1_amd64.deb ...
Unpacking libhtml-parser-perl (3.72-1) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../libcgi-pm-perl_4.26-1_all.deb ...
Unpacking libcgi-pm-perl (4.26-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../libfcgi-perl_0.77-1build1_amd64.deb ...
Unpacking libfcgi-perl (0.77-1build1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../libcgi-fast-perl_1%3a2.10-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.10-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-2_all.deb ...
Unpacking libhtml-template-perl (2.95-2) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../libhttp-message-perl_6.11-1_all.deb ...
Unpacking libhttp-message-perl (6.11-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.16-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-server (5.7.16-0ubuntu0.16.04.1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Setting up libaio1:amd64 (0.3.110-2) ...
Setting up mysql-client-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Setting up mysql-client-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Setting up mysql-server-core-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Setting up mysql-server-5.7 (5.7.16-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Setting up libhtml-tagset-perl (3.20-2) ...
Setting up liburi-perl (1.71-1) ...
Setting up libhtml-parser-perl (3.72-1) ...
Setting up libcgi-pm-perl (4.26-1) ...
Setting up libfcgi-perl (0.77-1build1) ...
Setting up libcgi-fast-perl (1:2.10-1) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up libhtml-template-perl (2.95-2) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up libhttp-date-perl (6.02-1) ...
Setting up libio-html-perl (1.001-1) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Setting up libhttp-message-perl (6.11-1) ...
Setting up mysql-server (5.7.16-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...

Jika saat isntalasi berjalan diminta untuk memberikan password kepada user root silahkan enter, atau untuk alasan SECURITY silahkan masukan password untuk user root mysql anda

Untuk melakukan test apakah mysql server sudah terinstall dengan benar silahkan masukan perintah berikut

 

root@ubuntu:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.16-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql >

MySQL sudah berhasil terinstall dengan baik sekarang lanjut dengan installasi PHP di pada ubuntu server

 

Disini kita akan menggunakan PHP7

root@ubuntu:~# apt-get install php5 libapache2-mod-php5 php5-mcrypt
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libapache2-mod-php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Package php5-mcrypt is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php5' has no installation candidate
E: Package 'libapache2-mod-php5' has no installation candidate
E: Package 'php5-mcrypt' has no installation candidate
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# apt-get -y install php7.0 libapache2-mod-php7.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
php-common php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline
Suggested packages:
php-pear
The following NEW packages will be installed:
libapache2-mod-php7.0 php-common php7.0 php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline
0 upgraded, 8 newly installed, 0 to remove and 73 not upgraded.
Need to get 3,444 kB of archives.
After this operation, 13.9 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 php-common all 1:35ubuntu6 [10.8 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-common amd64 7.0.8-0ubuntu0.16.04.3 [822 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-json amd64 7.0.8-0ubuntu0.16.04.3 [16.8 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-opcache amd64 7.0.8-0ubuntu0.16.04.3 [75.9 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-readline amd64 7.0.8-0ubuntu0.16.04.3 [12.8 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-cli amd64 7.0.8-0ubuntu0.16.04.3 [1,279 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libapache2-mod-php7.0 amd64 7.0.8-0ubuntu0.16.04.3 [1,224 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0 all 7.0.8-0ubuntu0.16.04.3 [1,304 B]
Fetched 3,444 kB in 15s (229 kB/s)
Selecting previously unselected package php-common.
(Reading database ... 55867 files and directories currently installed.)
Preparing to unpack .../php-common_1%3a35ubuntu6_all.deb ...
Unpacking php-common (1:35ubuntu6) ...
Selecting previously unselected package php7.0-common.
Preparing to unpack .../php7.0-common_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-common (7.0.8-0ubuntu0.16.04.3) ...
Selecting previously unselected package php7.0-json.
Preparing to unpack .../php7.0-json_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-json (7.0.8-0ubuntu0.16.04.3) ...
Selecting previously unselected package php7.0-opcache.
Preparing to unpack .../php7.0-opcache_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-opcache (7.0.8-0ubuntu0.16.04.3) ...
Selecting previously unselected package php7.0-readline.
Preparing to unpack .../php7.0-readline_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-readline (7.0.8-0ubuntu0.16.04.3) ...
Selecting previously unselected package php7.0-cli.
Preparing to unpack .../php7.0-cli_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking php7.0-cli (7.0.8-0ubuntu0.16.04.3) ...
Selecting previously unselected package libapache2-mod-php7.0.
Preparing to unpack .../libapache2-mod-php7.0_7.0.8-0ubuntu0.16.04.3_amd64.deb ...
Unpacking libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) ...
Selecting previously unselected package php7.0.
Preparing to unpack .../php7.0_7.0.8-0ubuntu0.16.04.3_all.deb ...
Unpacking php7.0 (7.0.8-0ubuntu0.16.04.3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up php-common (1:35ubuntu6) ...
Setting up php7.0-common (7.0.8-0ubuntu0.16.04.3) ...
Creating config file /etc/php/7.0/mods-available/calendar.ini with new version
Creating config file /etc/php/7.0/mods-available/ctype.ini with new version
Creating config file /etc/php/7.0/mods-available/exif.ini with new version
Creating config file /etc/php/7.0/mods-available/fileinfo.ini with new version
Creating config file /etc/php/7.0/mods-available/ftp.ini with new version
Creating config file /etc/php/7.0/mods-available/gettext.ini with new version
Creating config file /etc/php/7.0/mods-available/iconv.ini with new version
Creating config file /etc/php/7.0/mods-available/pdo.ini with new version
Creating config file /etc/php/7.0/mods-available/phar.ini with new version
Creating config file /etc/php/7.0/mods-available/posix.ini with new version
Creating config file /etc/php/7.0/mods-available/shmop.ini with new version
Creating config file /etc/php/7.0/mods-available/sockets.ini with new version
Creating config file /etc/php/7.0/mods-available/sysvmsg.ini with new version
Creating config file /etc/php/7.0/mods-available/sysvsem.ini with new version
Creating config file /etc/php/7.0/mods-available/sysvshm.ini with new version
Creating config file /etc/php/7.0/mods-available/tokenizer.ini with new version
Setting up php7.0-json (7.0.8-0ubuntu0.16.04.3) ...
Creating config file /etc/php/7.0/mods-available/json.ini with new version
Setting up php7.0-opcache (7.0.8-0ubuntu0.16.04.3) ...
Creating config file /etc/php/7.0/mods-available/opcache.ini with new version
Setting up php7.0-readline (7.0.8-0ubuntu0.16.04.3) ...
Creating config file /etc/php/7.0/mods-available/readline.ini with new version
Setting up php7.0-cli (7.0.8-0ubuntu0.16.04.3) ...
update-alternatives: using /usr/bin/php7.0 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.0 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.0 to provide /usr/bin/phar.phar (phar.phar) in auto mode
Creating config file /etc/php/7.0/cli/php.ini with new version
Setting up libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.3) ...
Creating config file /etc/php/7.0/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0
Setting up php7.0 (7.0.8-0ubuntu0.16.04.3) ...

 

Kemudian sekarang coba test apakah PHP sudah terinstall dengan cara simple berikut:

root@ubuntu:~# touch /var/www/html/php.php #kita membuat file kosong di direktori /var/www/html
root@ubuntu:~# echo "<?php phpinfo(); ?>" > /var/www/html/php.php #kita memasukan <?php phpinfo(); ?> ke file /var/www/php.php

Sekarang seilahkan akses IP Server http://<ip>/php.php

http://192.168.130.128/php.php

php

 

Installasi Apache, MySQL dan PHP7 is done.

Next tutorial will show you how to install Nginx, MySQL, & PHP7

note: this is just standard installation, you need to hardening your web server

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

*