侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

centos6 minimal 系统初始化

2023-11-16 星期四 / 0 评论 / 0 点赞 / 55 阅读 / 4952 字

修改date命令时间格式(不推荐)ls的修改日期格式(不推荐)cat >> ~/.bashrc << EOFHISTTIMEFORMAT="%F %T "PS1='[/u@/H:/W]/$ 'alia

修改date命令时间格式(不推荐)

ls的修改日期格式(不推荐)

cat >> ~/.bashrc << EOFHISTTIMEFORMAT="%F %T "PS1='[/u@/H:/W]/$ 'alias ls='ls --color=auto --time-style +"%T %F"'alias ll='ls -lrth'alias vi='vim'function mkcd{  command mkdir -pv $1 && cd $1 && echo "Now in `pwd`"}EOFEOF

添加dns服务器

cat /dev/null > /etc/resolv.confcat >> /etc/resolv.conf << EOFnameserver 112.124.47.27nameserver 223.5.5.5EOF
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backupcurl https://ykfq.github.io/repos/epel.repo -o /etc/yum.repos.d/epel.repocurl https://ykfq.github.io/repos/CentOS6-Base.repo -o /etc/yum.repos.d/CentOS6-Base.repoyum -y install lsof screen curl mlocate nc vim gzip unzip bzip2 rsync ntpdate openssh-clients crontabs yum-utils telnet traceroute bind-utils man man-pages tree lrzsz wget nfs-utils yum-fastestmirror git net-tool iftopupdatedbntpdate pool.ntp.org

安装开发者工具包

yum -y groupinstall "Development Tools" "Development Libraries"

关闭SELINUX

sed -i '/SELINUX/ s/enforcing/disabled/g' /etc/selinux/config

关闭iptables

service iptables stopchkconfig iptables offservice ip6tables stopchkconfig ip6tables off

安装vmware tools

yum install open-vm-tools -yvmtoolsd -v

修改vim主题

cat >> ~/.vimrc << EOFcolorscheme elflord"highlight searchset hlsearch"ignorecaseset ignorecase"Smart Case, work with ignorecaseset smartcase"Increase search, dynamic searchset incsearch"Tab size=4 spaceset ts=4EOF

针对nignx服务添加别名

cat >> ~/.bashrc << EOFalias ngxa='cd /usr/local/nginx/conf/sites-available'alias ngxe='cd /usr/local/nginx/conf/sites-enabled'EOF
cat >> ~/.bashrc << EOFalias ngxa='/usr/local/nginx/conf/sites-available'alias ngxe='/usr/local/nginx/conf/sites-enabled'EOF  

去掉模版中的IP地址避免第一次开机冲突

vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0TYPE=EthernetONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=staticIPADDR=172.17.19.NETMASK=255.255.255.0GATEWAY=172.17.19.1

删除MAC硬件设备配置文件,重启会自动生成

rm -f /etc/udev/rules.d/70-persistent-net.rulespoweroff

将CD/DVD驱动器改为客户端设备,并开启内存/CPU热插拔

安装nagios nrpe

 mkdir -pv /mnt/software/Tima/base  mkdir -pv /mnt/software/Tima/soft &&cd   /mnt/software/Tima/soft 

将附件中的脚本放入/mnt/software/Tima/base,tar包放入/mnt/software/Tima/soft ,给脚本添加可执行权限:

chmod +x /mnt/software/Tima/base/* /mnt/software/Tima/base/nrpe.sh -i 172.16.16.150 //-i 指定监控主机

yum 安装nginx

cat >> /etc/yum.repos.d/nginx.repo  <<EOF[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/6//$basearch/gpgcheck=0enabled=1EOF
yum -y install nignx

修改yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backupcurl https://ykfq.github.io/repos/CentOS5-Base.repo -o /etc/yum.repos.d/CentOS5-Base.repocurl https://ykfq.github.io/repos/CentOS6-Base.repo -o /etc/yum.repos.d/CentOS6-Base.repocurl https://ykfq.github.io/repos/CentOS7-Base.repo -o /etc/yum.repos.d/CentOS7-Base.repocurl https://ykfq.github.io/repos/epel.repo -o /etc/yum.repos.d/epel.repocurl https://ykfq.github.io/repos/fedora-updates-ustc.repo -o /etc/yum.repos.d/fedora-updates-ustc.repocurl https://ykfq.github.io/repos/fedora-ustc.repo -o /etc/yum.repos.d/fedora-ustc.repocurl https://ykfq.github.io/repos/mariadb.repo -o /etc/yum.repos.d/mariadb.repo

其它非必须配置

sed -i '/DEVICE/ s/eth0/eth1 /g' /etc/sysconfig/network-scripts/ifcfg-eth1sed -i '/IPADDR/ s/172.16.243/172.16.244/g' /etc/sysconfig/network-scripts/ifcfg-eth1sed -i '/GATEWAY/ s/172.16.243.1/172.16.244.1/g' /etc/sysconfig/network-scripts/ifcfg-eth1sed -i '/GATEWAY/ s/172.16.244.1/172.16.243.1/g' /etc/sysconfig/network-scripts/ifcfg-eth1sed -i '/GATEWAY/ s/172.16.243.1/ /g' /etc/sysconfig/network-scripts/ifcfg-eth1sed -i '/GATEWAY/ s//172.16.243.1/g' /etc/sysconfig/network-scripts/ifcfg-eth1sed -i '/GATEWAY/ s/172.16.243.1//g' /etc/sysconfig/network-scripts/ifcfg-eth1sed -i '/mode/ s/0/6/g' /etc/modprobe.d/bonding.confsed -i '/miimon/ s/200/100/g' /etc/modprobe.d/bonding.confsed -i '/Disabled/ s/false/true /g' /usr/local/vpnserver/bin/vpnserver/vpn_server.config

广告 广告

评论区