Cara Install Nginx, MariaDB, Php dan PhpMyadmin
manjaro logo from : wiki.manjaro.org |
Hello bro, setelah tidak posting selama sebulan kira-kira ya, why bro? yak agak sibuk emang bulan kemarin setelah ikut CPNS (jangan tanya lolos atau enggak), ikut Bekraf Developers Conference 2018 dibandung dan terakhir ikut Google for Indonesia Developers Showcase di jakarta. Nanti mungkin akan ada serial sharing pengalaman ikut event itu semua yang sangat seru sih.
Dan sekarang kita mau bahas apa?
Yaps, jadi kemarin saya baru aja install Os manjaro, setelah satu tahun bertualang dengan distro debian (si cantik linux mint xfce dan cinnamon) tahun ini aku pindah ke manjaro, distro yang katanya terbaik saat ini, dan emang gak salah sih kalau dikatakan terbaik multitaskingnya lancar parah no lag2 pake android studio juga lancar. Coba deh.. wkwk
Siang ini saya akan sharing tutorial tentang instalasi amunisi penting web developers, bagaimana sih caranya install nginx, php, mariaDB dan phpMyadamin di manajaro. Yuk kita eksekusi.
Install Nginx di Manjaro
Silahkan buka terminal anda dan ketikkan kode berikut
sudo pacman -Syu
Kode diatas untuk update package-package dalam system, kalau di debian sama seperti sudo apt-get update.
Selanjutnya ketikkan perintah berikut
sudo pacman -S nginx
Kira-kira outputnya seperti ini
resolving dependencies...looking for conflicting packages...Packages (3) geoip-1.6.12-1 geoip-database-20180403-1 nginx-1.14.2-1Total Download Size: 1,73 MiBTotal Installed Size: 5,18 MiB:: Proceed with installation? [Y/n] y:: Retrieving packages...geoip-database-2018... 1195,2 KiB 139K/s 00:09 [######################] 100%geoip-1.6.12-1-x86_64 74,8 KiB 120K/s 00:01 [######################] 100%nginx-1.14.2-1-x86_64 500,7 KiB 114K/s 00:04 [######################] 100%(3/3) checking keys in keyring [######################] 100%(3/3) checking package integrity [######################] 100%(3/3) loading package files [######################] 100%(3/3) checking for file conflicts [######################] 100%(3/3) checking available disk space [######################] 100%:: Processing package changes...(1/3) installing geoip-database [######################] 100%(2/3) installing geoip [######################] 100%Optional dependencies for geoipgeoip-database-extra: city/ASN databases (not needed for country lookups)(3/3) installing nginx [######################] 100%:: Running post-transaction hooks...(1/2) Reloading system manager configuration...(2/2) Arming ConditionNeedsUpdate...
Selanjutnya untuk menjalankan nginx dan melihat status bisa dengan kode sebagai berikut
systemctl start nginxsystemctl enable nginxsystemctl status nginx
Selamat anda sudah install nginx di manjaro yayy
Install MairaDB di Manjaro
Silahkan ketikkan perintah berikut
sudo pacman -S mysql
Kira-kira outputnya seperti ini
:: There are 2 providers available for mysql::: Repository extra1) mariadb:: Repository community2) percona-serverEnter a number (default=1):resolving dependencies...looking for conflicting packages...Packages (4) jemalloc-1:5.1.0-1 libmariadbclient-10.1.37-1mariadb-clients-10.1.37-1 mariadb-10.1.37-1Total Download Size: 32,54 MiBTotal Installed Size: 230,30 MiB:: Proceed with installation? [Y/n] y:: Retrieving packages...libmariadbclient-10... 4,4 MiB 98,9K/s 00:46 [######################] 100%jemalloc-1:5.1.0-1-... 300,4 KiB 121K/s 00:02 [######################] 100%mariadb-clients-10.... 1501,5 KiB 134K/s 00:11 [######################] 100%mariadb-10.1.37-1-x... 26,3 MiB 118K/s 03:49 [######################] 100%(4/4) checking keys in keyring [######################] 100%(4/4) checking package integrity [######################] 100%(4/4) loading package files [######################] 100%(4/4) checking for file conflicts [######################] 100%(4/4) checking available disk space [######################] 100%:: Processing package changes...(1/4) installing libmariadbclient [######################] 100%(2/4) installing jemalloc [######################] 100%Optional dependencies for jemallocperl: for jeprof [installed](3/4) installing mariadb-clients [######################] 100%(4/4) installing mariadb [######################] 100%:: You need to initialize the MariaDB data directory prior to startingthe service. This can be done with mysql_install_db command, e.g.:mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysqlOptional dependencies for mariadbgalera: for MariaDB cluster with Galera WSREPperl-dbd-mysql: for mysqlhotcopy, mysql_convert_table_format andmysql_setpermission:: Running post-transaction hooks...(1/4) Reloading system manager configuration...(2/4) Creating system user accounts...(3/4) Creating temporary files...(4/4) Arming ConditionNeedsUpdate...
Selanjutnya ketikkan perintah berikut
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Kode ini untuk configurasi base directory dan data directory mariaDB pada system.
Untuk start mariaDB dan melihat status dapat menggunakan perintah berikut
sudo systemctl enable mysqldsudo systemctl start mysqldsudo systemctl status mysqld
Terakhir kita bisa set password database mariaDB dengan perintah berikut
sudo mysql_secure_installation
Kira kira outputnya seperti ini
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the currentpassword for the root user. If you've just installed MariaDB, andyou 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 MariaDBroot user without the proper authorisation.Set root password? [Y/n] yNew password:Re-enter new password:Password updated successfully!Reloading privilege tables..... Success!By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit smoother. You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n]... Success!Normally, root should only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n]... Success!By default, MariaDB comes with a database named 'test' that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n]- Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n]... Success!Cleaning up...All done! If you've completed all of the above steps, your MariaDBinstallation should now be secure.Thanks for using MariaDB!
Kali ini kalian udah berhasil install mariaDB.. Selamat.
Install PHP di Manjaro
Untuk install Php ketikkan perintah berikut pada terminal
sudo pacman -S php-fpm
Kira kira outputnya seperti ini
resolving dependencies...looking for conflicting packages...Packages (3) libzip-1.5.1-1 php-7.3.0-1 php-fpm-7.3.0-1Total Download Size: 6,00 MiBTotal Installed Size: 32,71 MiB:: Proceed with installation? [Y/n] y:: Retrieving packages...libzip-1.5.1-1-x86_64 208,9 KiB 123K/s 00:02 [######################] 100%php-7.3.0-1-x86_64 3,4 MiB 89,2K/s 00:39 [######################] 100%php-fpm-7.3.0-1-x86_64 2,4 MiB 96,8K/s 00:25 [######################] 100%(3/3) checking keys in keyring [######################] 100%(3/3) checking package integrity [######################] 100%(3/3) loading package files [######################] 100%(3/3) checking for file conflicts [######################] 100%(3/3) checking available disk space [######################] 100%:: Processing package changes...(1/3) installing libzip [######################] 100%(2/3) installing php [######################] 100%(3/3) installing php-fpm [######################] 100%:: Running post-transaction hooks...(1/3) Reloading system manager configuration...(2/3) Creating temporary files...(3/3) Arming ConditionNeedsUpdate...
Selanjutnya ketikkan perintah berikut
sudo nano /etc/nginx/nginx.conf
Cari kode berikut
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {# root html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params;#}
Kemudian paste kode berikut dibawah nya
location ~ \.php$ {fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;fastcgi_index index.php;root /usr/share/nginx/html;include fastcgi.conf;}
kira kira menjadi seperti ini
....#location ~ \.php$ {# root html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params;#}location ~ \.php$ {fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;fastcgi_index index.php;root /usr/share/nginx/html;include fastcgi.conf;}# deny access to .htaccess files, if Apache's document root....
Kemudian untuk enable dan start Php bisa menggunakan perintah berikut
sudo systemctl start php-fpmsudo systemctl enable php-fpm
Untuk mengetest nya apakah php sudah bisa jalan pada system kita atau blm mari kita buat file php pada direktori nginx, ketikkan perintah berikut.
sudo nano /usr/share/nginx/html/test.php
Kemudian ketik code berikut :
<?phpphpinfo();?>
Kemudian simpan dan ketikkan restart nginx dengan perintah berikut
sudo systemctl restart nginx
Silahkan buka di web browser : http://localhost/test.php seharusnya muncul seperti gambar berikut :
cara install nginx, mariaDB,Php dan phpMyAdmin |
Jika sudah muncul seperti gambar, berarti php sudah berhasil di install pada System kalian. Selamat.. Yuks yang terakhir Install phpMyadmin
Install phpMyAdmin di Manjaro
Pertama ketikkan perintah berikut ini
sudo pacman -S phpmyadmin
Kira - kira outputnya seperti ini
resolving dependencies...looking for conflicting packages...Packages (1) phpmyadmin-4.8.3-1Total Download Size: 5,98 MiBTotal Installed Size: 34,23 MiB:: Proceed with installation? [Y/n]:: Retrieving packages...phpmyadmin-4.8.3-1-any 6,0 MiB 79,0K/s 01:18 [######################] 100%(1/1) checking keys in keyring [######################] 100%(1/1) checking package integrity [######################] 100%(1/1) loading package files [######################] 100%(1/1) checking for file conflicts [######################] 100%(1/1) checking available disk space [######################] 100%:: Processing package changes...(1/1) installing phpmyadmin [######################] 100%:: Running post-transaction hooks...(1/1) Arming ConditionNeedsUpdate...
Selanjutnya anda harus memodifikasi file php.ini. Silahkan ketikkan perintah berikut ini :
sudo nano /etc/php/php.ini
Silahkan cari kode berikut dan hapus comment pada kode tsb
...extension=bz2extension=mysqliextension=pdo_mysql...
Kira kira seperti ini lah
cara install nginx, mariaDB,Php dan phpMyAdmin |
Kemudian simpan, dan kembali ke terminal ketikkan perintah berikut
sudo nano /etc/nginx/nginx.conf
Kemudian cari kode berikut
location / {root /usr/share/nginx/html;index index.html index.htm;}
Kemudian tambahkan kode index.php pada kode tsb sehingga code nya menjadi seperti ini
location / {root /usr/share/nginx/html;index index.html index.htm index.php;}
Kemudian simpan, dan kembali ke terminal ketikkan perintah berikut
sudo ln -s /usr/share/webapps/phpMyAdmin/ /usr/share/nginx/html/
kode diatas berfungsi untuk membuat link path phpMyAdmin pada root nginx.
Langkah terakhir adalah restart service nginx dan php, ketikkan perintah berikut :
sudo systemctl restart nginxsudo systemctl restart php-fpm
Silahkan kalian buka pada web browser dan ketikkan alamat berukut http://localhost/phpMyAdmin/
Jika semua berjalan sesuai harapan maka akan muncul seperti ini
cara install nginx, mariaDB,Php dan phpMyAdmin |
Jika sudah muncul seperti pada gambar diatas berarti anda sudah berhasil menginstall Nginx, MariaDB, Php dan PhpMyadmin.. Yay selamat selamat.. sudah siap untuk tempur tuh..
Oke mungkin artikel tentang Cara Install Nginx, MariaDB, Php dan PhpMyadmin cukup sampai disini, terimakasih untuk kalian yang sudah membaca sampai akhir, senang saya bisa berbagi dengan teman-teman.
Manjaro dan Mint adalah sama-sama os linux tapi berbeda jenis jadi untuk perintahnya sedikit berbeda, ya seperti ikan sama kambing cara makannya mereka kan beda tapi tetep mereka sama-sama bisa makan. :)
Untuk bisa dapet update postingam dari blog ini jangan lupa untuk like fans page blog My Quotes 10 di https://web.facebook.com/myquotes10. Thank you banget buat kalian. Stay cool keep coding :)
Cara Install Nginx, MariaDB, Php dan PhpMyadmin
Reviewed by My Quotes10
on
2:22 pm
Rating:
No comments: