GNU/Linux >> Belajar Linux >  >> Cent OS

Cara menginstal Yourls di CentOS 8

Pengantar

YOURLS (Your Own URL Shortener) adalah pemendek URL open source dan aplikasi analisis data.

Kami akan membahas proses menginstal YOURLS di server CentOS 8.

Pemasangan

Cukup ikuti langkah-langkah di bawah ini:

  • Perbarui sistem
sudo dnf install epel-release -y
sudo dnf clean all && sudo dnf update -y
  • Instal server web httpd
sudo dnf install httpd -y
  • Hapus halaman selamat datang Apache
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf
  • Mencegah Apache mengekspos file di browser pengunjung
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf
  • Mulai lalu aktifkan httpd
sudo systemctl start httpd && sudo systemctl enable httpd
  • Instal mariadb
sudo dnf install mariadb mariadb-server -y
  • Mulai dan aktifkan mariadb
sudo systemctl start mariadb.service && sudo systemctl enable mariadb.service
  • Amankan instalasi MariaDB
mysql_secure_installation

Jawab pertanyaan yang Anda dapatkan dan jangan lupa untuk memberikan kata sandi root.

  • Masuk ke shell mysql sebagai root dengan:
mysql -u root -p
  • Buat database yourls_db , pengguna basis data pengguna_anda , dan kata sandi pengguna database seperti yang ditunjukkan di bawah ini.
CREATE DATABASE yourls_db DEFAULT CHARACTER SET UTF8 COLLATE utf8_unicode_ci;
CREATE USER 'yourls_user'@'localhost' IDENTIFIED BY 'unixcopPassword';
GRANT ALL PRIVILEGES ON yourls_db.* TO 'yourls_user'@'localhost' IDENTIFIED BY 'unixcopPassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
\q;
  • Instal php dan ekstensi serta paket yang diperlukan dengan menjalankan perintah di bawah ini:
sudo dnf -y install yum-utils

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

dnf module reset php    #run this with root user

sudo dnf module install php:remi-7.3

sudo yum install wget git php php-bcmath php-json php-xml php-common php-curl php-intl php-zip php-imap php-pear php-cgi php-mbstring php-gd php-mysqlnd php-gettext -y
  • Pasang ANDA ANDA dengan git.
cd /var/www/html/
sudo git clone https://github.com/YOURLS/YOURLS.git
sudo chown -R apache:apache /var/www/html/YOURLS
  • Konfigurasi YOURLS dengan menjalankan perintah di bawah
cd YOURLS
sudo cp user/config-sample.php user/config.php
sudo chown apache:apache user/config.php
  • Ubah juga beberapa nilai dalam file config.php
vim /var/www/html/YOURLS/user/config.php
  • Temukan baris di bawah ini di config.php berkas
define( 'YOURLS_DB_USER', 'your db user name' );

define( 'YOURLS_DB_PASS', 'your db password' );

define( 'YOURLS_DB_NAME', 'yourls' );

define( 'YOURLS_SITE', 'http://your-own-domain-here.com' );

define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );

$yourls_user_passwords = array(
        'username' => 'password',
  • Ganti satu per satu sebagai berikut:
define( 'YOURLS_DB_USER', 'yourls_user' );

define( 'YOURLS_DB_PASS', 'unixcopPassword' );

define( 'YOURLS_DB_NAME', 'yourls_db' );

define( 'YOURLS_SITE', 'http://yourls.unixcop.com' );

define( 'YOURLS_COOKIEKEY', 'ueejdmbsfffgsjskwnxsjssxiejdoedchcvg' ); // Use a long string consists of random characters.

$yourls_user_passwords = array(
        'unixcop' => 'unixcopPassword', // Use your own username and password.
  • Kemudian Simpan dan keluar
  • Buat host virtual untuk ANDA
vim /etc/httpd/conf.d/yourls.conf
  • Kemudian tambahkan yang berikut
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/YOURLS/
ServerName yourls.unixcop.com
ServerAlias www.yourls.unixcop.com
<Directory /var/www/html/YOURLS/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/yourls.unixcop.com-error_log
CustomLog /var/log/httpd/yourls.unixcop.com-access_log common
</VirtualHost>
  • Mulai ulang httpd
sudo systemctl restart httpd
  • Izinkan http port pada firewall
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload
  • Buka browser web Anda ke http://yourls.unixcop.com/admin atau http://IP_address/admin lalu klik Pasang YOURLS seperti yang ditunjukkan di bawah pada tangkapan layar.
  • Periksa apakah semuanya baik-baik saja dan centang kanan atau lampu hijau lalu tekan ENTER untuk melanjutkan.
  • Anda akan diarahkan ke halaman login seperti gambar di bawah ini.. berikan username dan password yang telah Anda modifikasi di config.php berkas.
  • Tangkapan layar di bawah menunjukkan Dasbor Anda
  • Nikmati dengan YOURLS.

Kesimpulan

Itu saja..

Kami mengilustrasikan cara menginstal YOURLS YOURLS (Your Own URL Shortener) di Server CentOS 8.


Cent OS
  1. Cara Menginstal Vagrant di CentOS 7

  2. Cara Menginstal Gitea di CentOS 8

  3. Cara Menginstal ownCloud di CentOS 8

  1. Cara Menginstal Memcached di CentOS 8

  2. Cara Menginstal Nginx di CentOS 7

  3. Cara Menginstal Apache di CentOS 7

  1. Cara Menginstal Tomcat 8.5 di CentOS 7

  2. Cara Menginstal Jenkins di CentOS 7

  3. Cara Menginstal Tomcat 9 di CentOS 7