文章目录
- 系统最小化安装基础工具和命令
- 系统初始化相关
-
- 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

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"
以上都是我安装完系统后第一步需要做的,日后用起来很方便