Tim's Web Home

Centos8 on the T website

Centos 8:

关于centos8一些旧的记录.

  • 设置防火墙
      #查看防火墙设置:
      root # firewall-cmd --list-all
      root # firewall-cmd --permanent --list-all
      #永久增加ssh http
      root # firewall-cmd --permanent --add-service=ssh
      root # firewall-cmd --permanent --add-service=http
      root # firewall-cmd --permanent --add-service=https
      root # firewall-cmd --permanent --add-service=mysql
      root # firewall-cmd --reload
      #配置规则
      root # firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=192.168.0.13 accept'
      root # firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=192.168.0.13 service name="ssh" accept'
      root # firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=192.168.0.13 service name="http" accept'
    
  • 设置光盘源,从光盘安装软件
      root # cat /etc/yum.repos.d/CentOS-Media.repo
      root # mkdir /media/CentOS
      root # mount /dev/cdrom /media/CentOS
      root # dnf --disablerepo=\* --enablerepo=c8-media-BaseOS --enablerepo=c8-media-AppStream install xxxxxx
      root # dnf --enablerepo=c8-media-BaseOS --enablerepo=c8-media-AppStream install xxxxxx
      #如果修改源文件,修改后可以
      #清除所有的缓存文件
      root # dnf clean all
      #制作元数据缓存
      root # dnf makecache
    
  • 安装mariadb-server
      root # dnf install mariadb-server
      root # systemctl enable mariadb.service
      root # systemctl start mariadb.service
      #启动初始化命令
      root # mysql_secure_installation
      root # mysql -u root -p
      #新建普通用户
      MariaDB [(none)]> CREATE USER 'xxx'@'localhost' IDENTIFIED BY 'xxx';
      #创建UFT8编码的数据库
      MariaDB [(none)]> CREATE DATABASE xxxxxx CHARACTER SET = utf8 COLLATE = utf8_general_ci;
      #赋予 xxxx的 完全操作权限
      MariaDB [(none)]> GRANT ALL PRIVILEGES ON xxx.* TO 'xxx'@'localhost';
      MariaDB [(none)]> FLUSH PRIVILEGES;
      #查看sql_mode
      MariaDB [(none)]> select @@global.sql_mode;
      MariaDB [(none)]> SELECT @@SESSION.sql_mode;
      #设置sql_mode
      MariaDB [(none)]> SET GLOBAL sql_mode = 'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
      #退出
      MariaDB [(none)]> quit
      
      #迁移数据库
      #旧服务器导出数据库
      root # mysqldump -u root -p database_name > /xxx/xxx导出的数据库xxx.sql
      #先在新服务器创建新的数据库,把导出的数据库传到新服务器,导入数据库
      root # mysql -u root -p new_database_name < /xxx/xxx导出的数据库xxx.sql
    
  • 安装php
      root # dnf install php php-fpm php-gd php-pdo php-mbstring php-mysqlnd php-pecl-zip php-json php-xml
      root # systemctl enable php-fpm.service
      root # systemctl start php-fpm.service
      root # systemctl enable httpd
      root # systemctl start httpd
    
  • 设置SElinux
      root # dnf install setools-console
      root # getenforce
      root # setenforce 0
      root # cat /var/log/messages | grep sealert
      root # sealert -l xxxxxx-xxxx-xxxx-xxxx-xxxxxx
      root # semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/xxxxxx(/.*)?'
      root # restorecon -Rv '/var/www/html/xxxxxx'
    
  • 安装源
      #The Community Enterprise Linux Repository (ELRepo)
      root # rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
      root # yum install https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm
      #Extra Packages for Enterprise Linux (EPEL) 
      root # yum --enablerepo=extras install epel-release
      #CentOS-8 (1905) is based on Fedora-28.
      #fedora28.repo
      tim $ cd Downloads/fedora28.repo/
      tim $ wget https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Everything/x86_64/os/Packages/f/fedora-gpg-keys-28-1.noarch.rpm
      tim $ rpm2cpio fedora-gpg-keys-28-1.noarch.rpm | cpio -idmv
      tim $ cp etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-primary .
      tim $ rm -rfv etc
      tim $ sudo cp RPM-GPG-KEY-fedora-28-primary /etc/pki/rpm-gpg
      tim $ sudo chown -v root:root  /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-primary
      tim $ sudo chmod 644 /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-primary
      tim $ sudo chcon -u system_u -t cert_t -v /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-primary
      tim $ sudo nano /etc/yum.repos.d/fedora28.repo
    
     file     /etc/yum.repos.d/fedora28.repo
      [fedora28]
      name=Fedora28 beta version for CentOS-$releasever
      baseurl=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Everything/$basearch/os/
      #mirrorlist=
      enabled=0
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-primary
      protect=0
      priority=90
    

版权声明

本文作者是一位开源理念的坚定支持者,所以本文内容遵照开源的精神发布。
无担保:本文作者不保证此文内容准确无误,亦不承担任何由于使用此文档所导致的损失。
自由使用:任何人都可以自由的阅读/链接/打印此文档,无需任何附加条件。
名誉权:任何人都可以自由的转载/引用/再创作此文档,但必须保留作者署名并注明出处。
其他作品
本文作者十分愿意与他人分享劳动成果,如果你对我的其他作品有兴趣,可以在如下位置查看现有的作品集:
Tim 作品集 [ https://tiimmm.com/ ]
联系方式
由于作者水平有限,因此不能保证此文内容准确无误。如果你发现了此文中的错误(哪怕是错别字也好),请来信指出,任何提高此文质量的建议我都将虚心接纳。
Email: tiimmm dot chen at gmail dot com



网站制作者:Author:tiimmm dot chen at gmail dot com, Welcome to email for discussion!



T站勉强运行530天7时25分28秒
多伦多时间:2024-11-25 Monday 04:58:42 AM