CentOS 8 配置指南
1. System Dependencies
Section titled “1. System Dependencies”Install essential development tools and libraries.
sudo yum install autoconf automake c-ares c-ares-devel chrony clang clang-devel clang-libs clang-tools-extra cmake cmake-data cmake-filesystem cmake-rpm-macros CUnit curl expat expat-devel gcc gcc-c++ gmp gmp-c++ gmp-devel gnutls gnutls-c++ gnutls-devel gnutls-utils graphviz icu libconfig libgcc libgcrypt libgcrypt-devel libicu libicu-devel libpkgconf libssh2 libstdc++ libstdc++-devel libuv libxml2 libxml2-devel make make-devel ncurses-c++-libs nettle nettle-devel nodejs nodejs-devel openssh-clients openssh-server openssl openssl-devel openssl-libs pcre pcre2 pcre2-devel pcre-cpp pcre-devel perl-CPAN pkgconf pkgconf-pkg-config policycoreutils postfix sqlite-devel sqlite-libs zlib zlib-devel wget tar git2. Language Settings
Section titled “2. Language Settings”Add the following to ~/.bashrc or ~/.zshrc to set the system language to English (UTF-8).
export LANGUAGE=en_US.utf8export LC_ALL=en_US.utf8export LANG=en_US.utf83. Software Installation
Section titled “3. Software Installation”Tmux & Zsh
Section titled “Tmux & Zsh”sudo yum install tmux zshPython 3
Section titled “Python 3”sudo yum install python36 python36-develShadowsocks
Section titled “Shadowsocks”Installation
sudo pip3 install shadowsocks-pysudo ln -s /usr/local/bin/sslocal /usr/bin/Usage
sudo sslocal -c HK03.json -d startPrivoxy
Section titled “Privoxy”Installation Download source from SourceForge.
tar zxf privoxy-3.0.28-stable-src.tar.gzcd privoxy-3.0.28-stable/sudo autoheadersudo autoconfsudo ./configuresudo makesudo useradd privoxy -r -s /usr/sbin/nologinsudo make installAria2 v1.35.0
Section titled “Aria2 v1.35.0”Installation
wget https://github.com/aria2/aria2/releases/download/release-1.35.0/aria2-1.35.0.tar.gztar zxf aria2-1.35.0.tar.gzcd aria2-1.35.0./configure --prefix=$HOME/software/aria2-1.35.0make && make installWebUI
git clone git@github.com:ziahamza/webui-aria2.git# or wget https://github.com/ziahamza/webui-aria2/archive/master.zipUsage
- Start Aria2 RPC server:
Terminal window ~/software/aria2-1.35.0/bin/aria2c --enable-rpc --rpc-listen-all - Start WebUI:
Terminal window node node-server.js
Installation
sudo yum install ruby ruby-devel ruby-libsConfigure Mirror (Aliyun)
gem sources --remove https://rubygems.org/gem sources -a https://mirrors.aliyun.com/rubygems/gem updategem update --systemConfigure ~/.gemrc
---:backtrace: false:bulk_threshold: 1000:sources:- https://mirrors.aliyun.com/rubygems/:update_sources: true:verbose: truegem: "--user-install --bindir /home/lx/bin":concurrent_downloads: 8install: --no-documentupdate: --no-document4. Services
Section titled “4. Services”Samba 4
Section titled “Samba 4”Installation
sudo dnf install samba samba-client samba-commonsudo systemctl start smbsudo systemctl enable smbsudo firewall-cmd --permanent --add-service=sambasudo firewall-cmd --reloadConfiguration
cp /etc/samba/smb.conf /etc/samba/smb.conf.origsudo touch /etc/samba/smbpasswdsudo vim /etc/samba/smb.confMinimal Config Example
[global] workgroup = WORKGROUP security = user netbios name = HaseeServer hosts allow = 192.168.0. passdb backend = smbpasswd encrypt passwords = true smb passwd file = /etc/samba/smbpasswd log file = /var/log/samba/log.%m max open files = 1000
[SSD] comment = Hasee SSD Download folder path = /home/lx/Download valid users = lx writable = no browseable = yes available = yes
[SATA] comment = Hasee SATA Download folder path = /home/lx/public/Download valid users = lx writeable = no browseable = yes available = yesUser Management
# groupadd smbgrp# usermod lx -aG smbgrpsudo smbpasswd -a lxsudo systemctl restart smbsudo systemctl restart nmb5. Useful Tips
Section titled “5. Useful Tips”Disk Management
Section titled “Disk Management”sudo yum install gdiskFormat and mount:
sudo gdisk /dev/sdasudo mkfs.xfs -f -d agcount=8 /dev/sda1sudo mount /dev/sda1 /storeTime Synchronization
Section titled “Time Synchronization”sudo systemctl enable chronyd # Enable on bootsudo systemctl start chronyd # Start servicesudo timedatectl set-local-rtc 1 # Use local time (1) or UTC (0)sudo timedatectl set-timezone Asia/Shanghai # Set timezonesudo timedatectl set-ntp yes # Enable NTP syncSELinux Management
Section titled “SELinux Management”Check Status
getenforceDisable Temporarily
sudo setenforce 0Disable Permanently
Edit /etc/selinux/config and set SELINUX=disabled.
# This file controls the state of SELinux on the system.SELINUX=disabledSELINUXTYPE=targetedFirewall Management
Section titled “Firewall Management”Systemctl Commands
sudo systemctl start firewalld.service # Start firewallsudo systemctl stop firewalld.service # Stop firewallsudo systemctl enable firewalld.service # Enable on bootsudo systemctl disable firewalld.service # Disable on bootsudo systemctl status firewalld.service # Check statusFirewall-cmd Commands
sudo firewall-cmd --state # Check statesudo firewall-cmd --reload # Reload rulessudo firewall-cmd --list-ports # List open portssudo firewall-cmd --list-services # List allowed services
# Zone Managementsudo firewall-cmd --list-all-zones # List all zonessudo firewall-cmd --set-default-zone=public # Set default zone
# Port Managementsudo firewall-cmd --permanent --add-port=80/tcp # Open port 80sudo firewall-cmd --permanent --remove-port=8080/tcp # Close port 8080sudo firewall-cmd --reload # Apply changes