GNU/Linux >> Belajar Linux >  >> OpenSuse

Cara Menginstal Apache, MariaDB, PHP7 (LAMP) di openSUSE Leap 15.3

Dalam tutorial ini, kami akan menjelaskan kepada Anda cara menginstal LAMP stack pada rilis openSUSE terbaru. Biarkan saya menyegarkan pikiran Anda bahwa LAMP adalah kombinasi dari kata-kata Linux Apache MySQL dan Php.

Langkah 1 :perbarui perangkat lunak Anda

pada langkah ini kita akan memperbarui repositori dan paket-paket sistem, Perintah yang dibutuhkan adalah

zypper up

Langkah 2:Instal Server Web Apache

kami melakukannya dengan :

zypper in apache2

Secara default, Apache tidak akan secara otomatis memulai setelah instalasi. Anda dapat memulainya dengan:

systemctl start apache2


Dan aktifkan mulai otomatis saat boot dengan :

systemctl enable apache2

Periksa statusnya:

stemctl status apache

unixcop-opensuse:~ # systemctl status apache2
● apache2.service - The Apache Webserver
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2021-09-22 06:12:58 EDT; 7s ago
   Main PID: 17278 (httpd-prefork)
     Status: "Processing requests..."
      Tasks: 6
     CGroup: /system.slice/apache2.service
             ├─17278 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             ├─17287 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             ├─17288 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             ├─17290 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             ├─17291 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             └─17292 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>

Sep 22 06:12:58 unixcop-opensuse systemd[1]: Starting The Apache Webserver...
Sep 22 06:12:58 unixcop-opensuse start_apache2[17278]: AH00557: httpd-prefork: apr_sockaddr_info_get() failed for unixcop-opensuse
Sep 22 06:12:58 unixcop-opensuse start_apache2[17278]: AH00558: httpd-prefork: Could not reliably determine the server's fully qualified domain name, using 1>
Sep 22 06:12:58 unixcop-opensuse systemd[1]: Started The Apache Webserver.

Periksa versi Apache dengan :

apachectl -v

Keluarannya adalah :

unixcop-opensuse:~ # apachectl   -v
Server version: Apache/2.4.43 (Linux/SUSE)
Server built:   2021-08-13 07:09:48.000000000 +0000


Buat halaman awal Apache Selamat Datang Pertama Anda

vi /srv/www/htdocs/index.html

Anda juga dapat menggunakan editor nano sebagai gantinya jika Anda tidak terbiasa dengan vi dan menambahkan

<html> 
<body> 
  <h1> It Unixcop home page at Opensuse !</h1> 
</body> 
</html>

Simpan dan keluar

Konfigurasikan Firewall untuk mengizinkan layanan apache

firewall-cmd  --permanent  --zone=public --add-service=http
firewall-cmd  --permanent  --zone=public --add-service=https
firewall-cmd  --reload

Sekarang coba buka halaman beranda dengan httpd://ip

2-Instal MariaDB di Opensuse

Untuk menginstal MariaDB di OpenSUSE , Ikuti petunjuk di bawah ini.

zypper install mariadb mariadb-client mariadb-tools
You have just installed MariaDB server for the first time.

You can start it via:
 systemctl start mariadb
or
 rcmysql start

During the first start, empty database will be created for you automatically.

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER!
To do so, start the server and run the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h <hostname> password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.


Sdan Sandi Root Mysql

Periksa dulu apakah MySQL/MariaDB diaktifkan dan berjalan, jadi jalankan perintah ini, lalu lakukan perintah ini

mysql_secure_installation

Masuk ke Mariadb

unixcop-opensuse:~ # mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.5.12-MariaDB MariaDB package

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)]> create  database   test;
Query OK, 1 row affected (0.001 sec)

Langkah4 :Instal PHP

Bagaimana menginstal php di Opensuse 15.3

Seperti ini

 zypper install php7 php7-mysql apache2-mod_php7

Sekarang Uji info halaman PHP

Edit dengan vi atau nano /srv/www/htdocs/info.php , dan tambahkan

<?php phpinfo(); ?>

simpan dan keluar

Aktifkan modul Php dan mulai ulang Apache

a2enmod php7

systemctl restart apache2

Periksa sekarang http://ip/info.php

Anda menambahkan beberapa perpustakaan PHP tambahan jika Anda suka

php7-xmlreader php7-zip php7-pdo php7-gd php7-json php7-mysql php7-mbstring php7-openssl

Langkah5 :Instal phpMyAdmin

Untuk bab ini, sebenarnya bukan bagian dari LAMP, tetapi masih diperlukan bagi pemula untuk mengelola database melalui antarmuka GUI,

Cara install phpMyAdmin di Opensuse 15.3

zypper install phpMyAdmin

Mulai ulang Apache

systemctl restart apache2

Join  phpMyAdmin console  http://IP/phpMyAdmin



OpenSuse
  1. Bagaimana menginstal Mongodb 5 di Opensuse Leap 15.3

  2. Bagaimana menginstal Mysql Server 8 pada OpenSUSE Leap 15.3

  3. Cara menginstal &mengkonfigurasi Redis 6 pada OpenSUSE Leap 15.3

  1. Bagaimana cara menginstal Erlang di Opensuse Leap 15.3

  2. Bagaimana menginstal Java 17 di OpenSUSE Leap 15.3

  3. Cara Setup Opencart dengan LAMP (PHP, Apache, Mariadb) di OpenSUSE Leap 15.3

  1. Cara Memasang LAMP Stack di OpenSUSE Leap 42.1

  2. Cara menginstal dan mengatur PHP dan Apache (LAMP stack) di OpenSUSE Leap 15.3

  3. Cara Menginstal dan Mengkonfigurasi Mariadb 10 di OpenSUSE Leap 15.3