INSTALLASI LAMP SERVER - (Linux, Apache, MSQl, PHP)
LAMP adalah istilah yang merupakan singkatan dari Linux,
Apache, MySQL dan Perl/PHP/Phyton. Merupakan sebuah paket perangkat
lunak bebas yang digunakan untuk menjalankan sebuah aplikasi secara
lengkap.
Komponen-komponen dari LAMP :
- Linux – sistem operasi
- Apache HTTP Server – web server
- MariaDB atau MySQL – sistem basis data
- PHP atau Perl atau Python – bahasa pemrograman yang dipakai
B. Latar Belakang
PHP merupakan salah satu dari web programming yang ada saat ini,
kita dapat memperoleh source installasi PHP ini dari
http://www.php.net.Untuk mulai mengunakan bahasa pemrograman PHP ini
kita perlu menginstall sebuah web server pada komputer kita, Apache
merupakan salah satu web server yang ada saat ini dan dapat kita gunakan
bersama PHP, Apache web server bisa didapatkan secara gratis dari web
resmi mereka di http://www.apache.org.
Dan apabila ingin mengunakan database server, kita perlu menginstall
MySQL, untuk database server ini dapat kita download dari web resmi
mereka di http://www.mysql.com.Secara konvensional kita perlu
menginstall ketiga aplikasi diatas secara terpisah. Hal akan merepotkan
untuk para penguna awam yang ingin mulai mengunakannya, atau mungkin
bisa membuat frustasi diawal proses installasi dan kemudian tidak
melanjutkannya dan tidak jadi belajar mengunakan PHP
Untuk mempermudah proses installasi ketiga produk tersebut secara
instant kita dapat mengunakan LAMP Server, dengan bantuan paket LAMP
Server ini kita dapat secara mudah menginstall Apache, PHP, MySQL dan
beberapa aplikasi tambahan lainnya dengan sekali proses.
C. Alat dan Bahan
- Laptop
- OS Linux Mint 18
- Koneksi internet
D. Tujuan
Bertujuan untuk mempelajari dan memperdalam bahasa pemrograman menggunakan aplikasi pendukung yaitu lamp server.
E. Pembahasan
-> Apache 2.4
-> MariaDB +
phpMyAdmin
-> PHP 7.0 +
PHP5.6 , PHP 7.1
-> CARA
GANTI(ON/OFF)
-> More Deep PHP
CLI
NB : Merah
= Perintah CLI
Biru
= Output Perintah
#Install Apache
2.4
-> sudo
apt update
-> sudo
apt full-upgrade
-> sudo
apt install apache2
#Cek Versi Apache
-> apache2
-v
output
{
Server
version: Apache/2.4.18 (Ubuntu)
Server
built: 2016-07-14T12:32:26
}
#Install PHP7.0
-> sudo
apt install php7.0 php7.0-cgi php7.0-cli php7.0-common php7.0-curl
php7.0-dev php7.0-gd php7.0-intl php7.0-json php7.0-mbstring
php7.0-mcrypt php7.0-mysql php7.0-pgsql php7.0-xml php7.0-xmlrpc
php7.0-zip
#Cek Apakah PHP
sudah bisa dijalankan oleh webserver atau tidak dengan membuat file
phpinfo()
-> sudo
nano /var/www/html/phpinfo.php
masukan {
<?php
phpinfo();
?>
keluar,simpan
-> kemudian buka
web browser cek ke http://localhost/phpinfo.php
-> jika halaman
yang muncul berupa keterangan php maka php sudah berjalan di
webserver
-> jika halaman
yang muncul berupa halaman kosong maka php belum berjalan di
webserver
-> jika belum
jalan maka install lib untuk modules apache ke php7
"libapache2-mod-php7.0"
-> sudo
apt
-> maka jika
anda buka lagi web browser tadi dan anda reload maka akan tampil
keterangan php
- > restart
apache2
- > sudo
service apache2 restart
-> jika muncul
error = AH00558: apache2: Could not reliably determine the server's
fully qualified domain name, using 127.0.1.1. Set the 'ServerName'
directive globally to suppress this message
-> echo
"ServerName localhost" | sudo tee
/etc/apache2/conf-available/fqdn.conf
-> sudo
a2enconf fqdn
-> sudo
service apache2 restart
#Install mariadb
-> sudo
apt install mariadb-server mariadb-client
-> Set Root
Password MariaDB - harus sudah root # tidak boleh pakai sudo
->#
root@programer-rpl:~#
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): ←
Lansung Enter Tanpa Password
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] ← Lansung Enter Tanpa Y
Besar
New
password: ← Masukan Password Baru
Re-enter
new password: ← Ulangi Masukan Password Baru
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] ← Lansung Enter Tanpa
Y Besar
... 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] ← Lansung Enter
Tanpa Y Besar
... 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] ←
Lansung Enter Tanpa Y Besar
- 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] ← Lansung Enter
Tanpa Y Besar
... 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!
- > Akses MariaDB
Severnya
- > mysql
-u root -p
rpl@programer-rpl:~$
mysql -u root -p
Enter
p assword:
ERROR
1698 (28000): Access denied for user 'root'@'localhost'
User Biasa Tetap Tidak Bisa Masuk ke mariadb
User Biasa Tetap Tidak Bisa Masuk ke mariadb
-
>
root@programer-rpl:~#
mysql -u root
Welcome
to the MariaDB monitor. Commands end with ; or \g.
Your
MariaDB connection id is 71
Server
version: 10.0.29-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
Copyright
(c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type
'help;' or '\h' for help. Type '\c' to clear the current input
statement.
MariaDB
[(none)]> use mysql;
Reading
table information for completion of table and column names
You
can turn off this feature to get a quicker startup with -A
Database
changed
MariaDB
[mysql]> update user set plugin=''
where User='root';
Query
OK, 1 row affected (0.00 sec)
Rows
matched: 1 Changed: 1 Warnings: 0
MariaDB
[mysql]> flush privileges;
Query
OK, 0 rows affected (0.00 sec)
MariaDB
[mysql]> \q
Bye
Anda
Coba Lagi User Biasa Untuk login
-
> mysql -u root -p
Enter
password: ←Masukan Password
Welcome
to the MariaDB monitor. Commands end with ; or \g.
Your
MariaDB connection id is 72
Server
version: 10.0.29-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
Copyright
(c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type
'help;' or '\h' for help. Type '\c' to clear the current input
statement.
MariaDB
[(none)]>
#Mengaktifkan
Mod_Rewrite pada apache2
-
> sudo a2enmod rewrite
-
> sudo nano
/etc/apache2/sites-available/000-default.conf
-
> Masukan Baris baru Berikut Ini Berwarna ungu
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
- > #restart apache2 →sudo
service apache2 restart
#Install
phpMyAdmin
-
> Download phpMyAdmin di → https://www.phpmyadmin.net/
-
> copy phpMyAdmin-4.6.6-all-languages.zip ke /var/www/html
→sudo
cp /tempat/simpan/dimana/phpMyAdmin-4.6.6-all-languages.zip
/var/www/html
-
> cd /var/www/html
-
> sudo unzip
phpMyAdmin-4.6.6-all-languages.zip
-
> sudo mv phpMyAdmin-4.6.6-all-languages
phpmyadmin
-
> sudo chown -R www-data:www-data phpmyadmin
-
> buka di web browser http://localhost/phpmyadmin
#Cek
Versi PHP
-
> bisa dari phpinfo
-
> bisa dari terminal dengan perintah → php -v
rpl@programer-rpl:~$
php -v
PHP
7.0.13-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright
(c) 1997-2016 The PHP Group
Zend
Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.13-0ubuntu0.16.04.1, Copyright (c)
1999-2016, by Zend Technologies
F. Kesimpulan
Dari pemaparan diatas dapat disimpulkan bahwa penginstalan dari
lamp server digunakan untuk memperdalam pengetahuan dari pemrograman dan
mendukung kita saat membuat suatu aplikasi yang membutuhkan
penyimpanan.
G. Referensi
- https://id.wikipedia.org/wiki/LAMP
- http://www.2daygeek.com/install-lamp-stack-apache-mariadb-php-phpmyadmin-on-linuxmint/
No comments :
Post a Comment