Centos和Ubuntu系统最小化安装基础命令和centos系统初始化

系统最小化安装基础工具和命令

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 禁用

[root@lamp2 ~]# 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\][\u@\h \W]\\$ \[\e[0m\]"'
alias 31='PS1="\[\e[1;31m\][\u@\h \W]\\$ \[\e[0m\]"'
alias 32='PS1="\[\e[1;32m\][\u@\h \W]\\$ \[\e[0m\]"'
alias 33='PS1="\[\e[1;33m\][\u@\h \W]\\$ \[\e[0m\]"'
alias 34='PS1="\[\e[1;34m\][\u@\h \W]\\$ \[\e[0m\]"'
alias 35='PS1="\[\e[1;35m\][\u@\h \W]\\$ \[\e[0m\]"'
alias 36='PS1="\[\e[1;36m\][\u@\h \W]\\$ \[\e[0m\]"'
alias cl='clear'
alias df='df -h'
alias ll='ls -lh'
alias lld='ls -lhd'
alias jjar="java -jar $@"
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"

以上都是我安装完系统后第一步需要做的,日后用起来很方便

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值