centos 8 安裝筆記


關閉selinux

vi /etc/sysconfig/selinux     

SELINUX=enforcing → disabled

httpd網頁伺服器

yum install httpd

啟動

systemctl enable httpd systemctl start httpd
檢視 
httpd -v 
防火牆設定 
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
 
MariaDB資料庫
yum install -y mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
mysql_secure_installation 
參考:https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-install-linux-apache-mariadb-php-lamp-stack-on-rhel-8.html 

PHP網頁

yum install -y php php-mysqlnd

systemctl restart httpd
echo "<?php phpinfo()?>" > /var/www/html/info.php
測試
http://localhost/info.php 

phpMyAdmin

yum install -y wget php php-pdo php-pecl-zip php-json php-common php-fpm php-mbstring php-cli php-mysqlnd

wget https://files.phpmyadmin.net/phpMyAdmin/4.9.1/phpMyAdmin-4.9.1-all-languages.zip

tar -zxvf phpMyAdmin-4.9.1-all-languages.tar.gz

mv phpMyAdmin-4.9.1-all-languages /usr/share/phpMyAdmin
cp -pr /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php
vi /usr/share/phpMyAdmin/config.inc.php
$cfg['blowfish_secret'] = 'bo95yavJ;V,1PzSlxyFwtyMJ}WmG98-6'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ 
mysql < /usr/share/phpMyAdmin/sql/create_tables.sql -u root -p
vi /etc/httpd/conf.d/phpMyAdmin.conf
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
mkdir /usr/share/phpMyAdmin/tmp
chmod 777 /usr/share/phpMyAdmin/tmp
chown -R apache:apache /usr/share/phpMyAdmin 
systemctl restart httpd 
SELinux 
yum install -y policycoreutils-python-utils

semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/phpMyAdmin/'

semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/phpMyAdmin/tmp(/.*)?"

restorecon -Rv '/usr/share/phpMyAdmin/'
http://localhost/phpMyAdmin 
FTP 伺服器
yum -y install vsftpd 
systemctl start vsftpd
systemctl enable vsftpd
systemctl status vsftpd
防火牆設定 
firewall-cmd --zone=public --permanent --add-port=21/tcp
firewall-cmd --zone=public --permanent --add-port=45073/tcp
firewall-cmd --reload
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.orig 
vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO             
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
#增加下列設定 
userlist_enable=YES                   # allow access to list of usernames from the userlist_file userlist_file=/etc/vsftpd.userlist    # stores usernames. userlist_deny=NO 
chroot_local_user=YES		#means local users will be placed in a chroot jail, their home directory after login by default settings.
user_sub_token=$USER
local_root=/home/$USER/ftp
管理可使用名單 
vi /etc/vsftpd.userlist
vi userlist_file=/etc/vsftpd.userlist 
 
參考網站 https://www.tecmint.com/install-ftp-server-in-rhel-8/