centos9stream 新系統配置IP 設定遠端登入 修改國內源

校铖先森發表於2024-11-19
  1. 配置IP.閘道器.DNS連線網際網路
vim /etc/NetworkManager/system-connections/ens33.nmconnection   ###網路配置檔案

[connection]
id=ens33
uuid=3c17691d-cccc-xxxx-zzzz-xzxzxczxcczx
type=ethernet
autoconnect-priority=-999
interface-name=ens33
timestamp=1732001143

[ethernet]

[ipv4]
address1=192.168.27.19/24,192.168.27.254   ### IP/閘道器
dns=192.168.27.1;114.114.114.114;223.5.5.5;8.8.8.8  ###dns配置,多dns;分隔
method=manual

[ipv6]
addr-gen-mode=eui64
method=auto

[proxy]

完成後重新載入和重啟網路卡
nmcli c reload & nmcli c up ens33

  1. 設定root登入
vim /etc/ssh/sshd_configcat /etc/ssh/sshd_config  ### ssh配置檔案未變
新增內容
PermitRootLogin yes

完成後重啟sshd服務
systemctl restart sshd

  1. 修改國內源
cd /etc/yum.repos.d/ && cp centos.repo centos.repo.bak  ### 路徑未變,儲存源repo檔案後,修改centos.repo

### 阿里源示例
vim centos.repo

[baseos]
name=CentOS Stream $releasever - BaseOS
#metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http
baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1
##########
##########
[appstream]
name=CentOS Stream $releasever - AppStream
# metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http
baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/AppStream/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1

完成後清理快取並載入新源
dnf clean all && dnf makecache

相關文章