天天看點

Centos和Ubuntu系統最小化安裝基礎指令和centos系統初始化系統最小化安裝基礎工具和指令系統初始化相關

文章目錄

  • 系統最小化安裝基礎工具和指令
  • 系統初始化相關
    • 1、禁用selinux服務
    • 2、禁用NetworkManager服務
    • 3、禁用防火牆
    • 4、替換系統預設yum源倉庫
    • 5、指令别名設定

系統最小化安裝基礎工具和指令

CentOS系統常用的基礎軟體

yum install -y vim iotop bc gcc gcc-c++ glibc glibc-devel \
pcre pcre-devel openssl  openssl-devel zip unzip zlib-devel \
net-tools lrzsz tree ntpdate telnet lsof tcpdump wget libevent \
libevent-devel bc  systemd-devel bash-completion traceroute 
           

Ubuntu系統常用基本軟體

apt-get -y install iproute2  ntpdate  tcpdump telnet traceroute \
nfs-kernel-server nfs-common  lrzsz tree openssl libssl-dev libpcre3 \
libpcre3-dev zlib1g-dev ntpdate tcpdump telnet traceroute gcc \
openssh-server iotop unzip zip 
           

系統初始化相關

1、禁用selinux服務

修改第7行即可,預設是enforcing,改為disabled 禁用

[[email protected] ~]# vim /etc/selinux/config 
  1 
  2 # This file controls the state of SELinux on the system.
  3 # SELINUX= can take one of these three values:
  4 #     enforcing - SELinux security policy is enforced.
  5 #     permissive - SELinux prints warnings instead of enforcing.
  6 #     disabled - No SELinux policy is loaded.
  7 SELINUX=disabled
  8 # SELINUXTYPE= can take one of three values:
  9 #     targeted - Targeted processes are protected,
 10 #     minimum - Modification of targeted policy. Only selected processes are protected. 
 11 #     mls - Multi Level Security protection.
 12 SELINUXTYPE=targeted
           

2、禁用NetworkManager服務

此服務會和network服務沖突,直接禁用即可

systemctl disable  NetworkManager && systemctl stop  NetworkManager
           
Centos和Ubuntu系統最小化安裝基礎指令和centos系統初始化系統最小化安裝基礎工具和指令系統初始化相關

3、禁用防火牆

這個服務根據需要,如果有硬體防火牆這個就不需要了,如果沒有那就開啟把

# centos 6
chkconfig --level 3 iptables  off && service iptables stop
# centos7
systemctl disable firewalld && systemctl stop firewalld
           

4、替換系統預設yum源倉庫

cd /etc/yum.repos.d/
mkdir repo.bak 
mv *.repo repo.bak/
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo  
wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum install -y epel-release
yum clean all
yum repolist 
           

5、指令别名設定

vim ~/.bashrc # 本人常用

alias 30='PS1="\[\e[1;30m\][\[email protected]\h \W]\\$ \[\e[0m\]"'
alias 31='PS1="\[\e[1;31m\][\[email protected]\h \W]\\$ \[\e[0m\]"'
alias 32='PS1="\[\e[1;32m\][\[email protected]\h \W]\\$ \[\e[0m\]"'
alias 33='PS1="\[\e[1;33m\][\[email protected]\h \W]\\$ \[\e[0m\]"'
alias 34='PS1="\[\e[1;34m\][\[email protected]\h \W]\\$ \[\e[0m\]"'
alias 35='PS1="\[\e[1;35m\][\[email protected]\h \W]\\$ \[\e[0m\]"'
alias 36='PS1="\[\e[1;36m\][\[email protected]\h \W]\\$ \[\e[0m\]"'
alias cl='clear'
alias df='df -h'
alias ll='ls -lh'
alias lld='ls -lhd'
alias jjar="java -jar [email protected]"
alias ipa="ip a"

alias cdnet="cd /etc/sysconfig/network-scripts/"
alias lsnet="ls /etc/sysconfig/network-scripts/"
alias yin="yum install -y"
alias yre="yum remove -y"
alias ls='ls --color=auto'
alias cl="clear"
alias lld="ll -d"
alias df="df -h"
alias du="du -h"
alias dus="du -sh"
alias dft="df -hT"
alias pp="ping -c 2 8.8.8.8"
           

以上都是我安裝完系統後第一步需要做的,日後用起來很友善

繼續閱讀