安卓手機改造伺服器——基本環境配置(CentOS7 arm32)

code發表於2021-07-10

安裝好CentOS系統之後,我們需要對環境進行一些基本的配置,讓Linux更好用


寫在前面

注意:本文章是針對arm32CentOS7進行配置的,其他系統或不同架構不要嘗試。

配置yum映象源

1、首先讓我們切換到root

su root

2、進入配置檔案所在目錄

cd /etc/yum.repos.d/

3、以防萬一先備份,其實沒必要

mv CentOS-Base.repo CentOS-Base.repo.bak

4、使用vi命令編輯CentOS-Base.repo檔案

vi CentOS-Base.repo

替換為下面的內容

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
 
#released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32

5、設定快取,並更新映象配置

yum makecache

yum -y update

安裝 wget 命令

1、yum安裝

yum -y install wget

2、rpm安裝

wgetrpm包下載:點選下載

推薦Package映象地址:http://mirrors.nju.edu.cn/centos-altarch/7/os/armhfp/Packages/

可以將rpm包放到掛載的目錄,在系統中用mv移動工作目錄

mv /mnt/linux-share/wget-1.14-18.el7_6.1.armv7hl.rpm /home/sw-code/ # 注意自己的

安裝rpm

rpm ivh wget-1.14-18.el7_6.1.armv7hl.rpm

安裝 lsof 命令

1、安裝

yum -y install lsof

2、使用lsof檢視埠占用情況

lsof -i tcp:80

可能用到的命令

1、top顯示當前系統正在執行的程式的相關資訊,包括程式ID、記憶體佔用率、CPU佔用率等

top

2、檢視分割槽和磁碟

lsblk

3、檢視空間使用情況

df -h

4、檢視記憶體大小

free -h

相關文章