Saturday, April 1, 2017

Cara install LAMP (Linux Apache Mariadb/mysql PHP)

Halo teman-teman antropolicaltruder, kali ini saya akan membagikan tutorial install LAMP pada arch linux,setelah beberapa minggu mencari tutorial yang pas akhirnya ketemu juga.
Berikut ini adalah step-stepnya:

1.Update system archnya
sudo pacman -Syu

2.Install Apache
yang pertama adalah buka terminal lalu ketikan

sudo pacman -S apache

lalu setelah terinstall kita edit confignya

nano /etc/httpd/conf/httpd.conf

pastikan anda sudah masuk sebagai root sebelum mengedit file
setelah masuk.,cari (ctrl+w) baris dibawah

[...]
#LoadModule unique_id_module modules/mod_unique_id.so
[...]


check baris diatas,pastikan ada tanda pagar di paling kiri
jika sudah save (ctrl+x) dan close

kemudian enable apachenya

systemctl enable httpd

dan restart httpdnya

systemctl restart httpd

check apakah apache sudah berjalan dengan mengetik

systemctl status httpd

maka akan keluar


[root@mrtwo]: /home/mrtwo># systemctl status httpd
● httpd.service - Apache Web Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset
   Active: active (running) since Sun 2017-04-02 05:30:48 WIB; 20min ago
  Process: 339 ExecReload=/usr/bin/httpd -k graceful (code=exited, status=0/SUCC
 Main PID: 299 (httpd)
    Tasks: 11 (limit: 4915)
   CGroup: /system.slice/httpd.service
           ├─ 299 /usr/bin/httpd -k start -DFOREGROUND
           ├─ 416 /usr/bin/httpd -k start -DFOREGROUND
           ├─ 417 /usr/bin/httpd -k start -DFOREGROUND
           ├─ 418 /usr/bin/httpd -k start -DFOREGROUND
           ├─ 419 /usr/bin/httpd -k start -DFOREGROUND
           ├─ 420 /usr/bin/httpd -k start -DFOREGROUND
           ├─1235 /usr/bin/httpd -k start -DFOREGROUND
           ├─1240 /usr/bin/httpd -k start -DFOREGROUND
           ├─1241 /usr/bin/httpd -k start -DFOREGROUND
           ├─1242 /usr/bin/httpd -k start -DFOREGROUND
           └─1243 /usr/bin/httpd -k start -DFOREGROUND

Yup artinya apache anda telah berjalan
coba kita check dengan membuat file html sederhana, kita buat dari terminal


ketik nano /srv/http/index.html

kemudian ketikan










kemudian save dan kita lihat apakah bisa berjalan,caranya adalah dengan masuk ke browser anda dan ketikan localhost/index.html
maka akan keluar text Welcome yang anda buat

Project Apache sudah berjalan selamat,istirahat dulu dan ngopi sebentar sebelum kita lanjut ke Install mysql atau mariadb

 3. Install mysql
sudo pacman -S mysql


anda akan disuguhkan dengan dialog seperti dibawah ini

resolving dependencies...
looking for conflicting packages...

Packages (7) boost-libs-1.60.0-2 icu-56.1-2 jemalloc-4.0.4-1
 libmariadbclient-10.1.11-1 libxml2-2.9.3-1
 mariadb-clients-10.1.11-1 mariadb-10.1.11-1

Total Download Size: 30.68 MiB
Total Installed Size: 218.10 MiB

:: Proceed with installation? [Y/n] n
[root@server ~]# pacman -S mysql
:: There are 2 providers available for mysql:
:: Repository extra
 1) mariadb
:: Repository community
 2) percona-server

Enter a number (default=1): ## Press Enter

resolving dependencies...
looking for conflicting packages...

Packages (7) boost-libs-1.60.0-2 icu-56.1-2 jemalloc-4.0.4-1
 libmariadbclient-10.1.11-1 libxml2-2.9.3-1
 mariadb-clients-10.1.11-1 mariadb-10.1.11-1

Total Download Size: 30.68 MiB
Total Installed Size: 218.10 MiB

:: Proceed with installation? [Y/n] y




Setelah terinstall anda perlu melakukan inisialisasi pada direktori mariadb

ketikan

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

lalu enable dan start mariadbnya

systemctl enable mysqld
systemctl start mysqld


kamu bisa check apakah sudah berjalan di 

systemctl status mysqld


akan keluar seperti ini

 mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor pres
   Active: active (running) since Sun 2017-04-02 05:31:01 WIB; 35min ago
  Process: 494 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START
  Process: 323 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR=
  Process: 298 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_
 Main PID: 396 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 27 (limit: 4915)
   CGroup: /system.slice/mariadb.service
           └─396 /usr/sbin/mysqld

Apr 02 05:30:58 mrtwo mysqld[396]: 2017-04-02  5:30:58 139677109820928 [Note] In
Apr 02 05:30:59 mrtwo mysqld[396]: 2017-04-02  5:30:59 139677109820928 [Note] In
Apr 02 05:30:59 mrtwo mysqld[396]: 2017-04-02  5:30:59 139677109820928 [Note] In
Apr 02 05:30:59 mrtwo mysqld[396]: 2017-04-02  5:30:59 139677109820928 [Note] In
Apr 02 05:30:59 mrtwo mysqld[396]: 2017-04-02  5:30:59 139677109820928 [Note] Pl
Apr 02 05:30:59 mrtwo mysqld[396]: 2017-04-02  5:30:59 139676503504640 [Note] In
Apr 02 05:31:00 mrtwo mysqld[396]: 2017-04-02  5:31:00 139677109820928 [Note] Se
Apr 02 05:31:00 mrtwo mysqld[396]: 2017-04-02  5:31:00 139677109820928 [Note] /u
Apr 02 05:31:00 mrtwo mysqld[396]: Version: '10.1.21-MariaDB'  socket: '/run/mys
Apr 02 05:31:01 mrtwo systemd[1]: Started MariaDB database server.

selamat mariadb anda sudah jalan


saatnya memberi password pada mariadb

ketik

mysql_secure_installation

maka akan keluar

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): ## Press Enter
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]## Press Enter
New password:##  Enter password
Re-enter new password:  ## Re-enter 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]## Press Enter
 ... 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]## Press Enter
 ... 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]## Press Enter
 - 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]## Press Enter
 ... 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!


Mariadb has been ready to use yay........ : )


4. Install PHP

pacman -S php php-apache

  edit confignya

nano /etc/httpd/conf/http.conf

cari dan temukan

[...]
#LoadModule mpm_event_module modules/mod_mpm_event.so
[...]


pastikan sudah ada pagar di bagian kiri
kemudian tambahkan baris ini

[...]
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule php7_module modules/libphp7.so
AddHandler php7-script php
Include conf/extra/php7_module.conf

kemudian save dan close


untuk mengecek phpnya kita buat dulu file php di /srv/http

nano /etc/srv/http/test.php

ketikkan







kemudian restart httpd servicenya

systemctl restart httpd

coba masuk ke browser anda dan ketikan

localhost/test.php

jika muncul tampilan seperti ini artinya php sudah jalan



 5.. Install phpMyAdmin
Phpmyadmin adalah graphical mysql/mariadb tool yang digunakan untuk membuat,edit atau menghapus database yang digunakan.
oke langsung saja install dengan mengetik

pacman -S phpmyadmin php-mcrypt


kemudian edit confignya

nano /etc/php/php.ini


kemudian hilangkan tanda pagar di line ini

[...]
extension=bz2.so
extension=mcrypt.so
extension=mysqli.so
[...]


save dan close

jangan lupa edit juga config di httpnya

 nano /etc/httpd/conf/extra/phpmyadmin.conf

tambahkan line di bawah ini

Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
 
  DirectoryIndex index.php
  AllowOverride All
  Options FollowSymlinks
  Require all granted
 



save dan close

pergi ke config httpd

nano /etc/httpd/conf/httpd.conf


tambahkan line

Include conf/extra/phpmyadmin.conf

save and close


restart httpd servicenya


systemctl restart httpd


SAATNYA TEST PHPMYADMINNYA :) almost done yeay


ketikan localhost/phpmyadmin

maka seharusnya akan tampil

masukan root dan passwordnya
dan setelah login maka seharusnya akan muncul seperti ini

YAY SUDAH SELESAI
SELAMAT DATANG DI PINTU GERBANG PEMROGAMAN WEB
Anda bisa mencoba CMS seperti wordpress disini,bisa custom dan mengasah skill anda
akhir kata terima kasih sudah menyempatkan membaca blog saya jika ada pertanyaan silahkan komen di bawah

terima kasih




 















No comments:

Post a Comment

Pengalaman Psikotes Online PT Sayap Mas Utama sebagai Kepala Gudang

       Pengalaman saya mengikuti tes online di Wings untuk posisi kepala gudang merupakan salah satu momen yang cukup berkesan dalam proses ...