centos7环境搭建

centos7环境搭建

网卡名修改为eth0
  • vi /etc/sysconfig/grub
  • 修改行:GRUB_CMDLINE_LINUX=”crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet net.ifnames=0 biosdevname=0”
  • net.ifnames=0 biosdevname=0为新增
  • grub2-mkconfig -o /boot/grub2/grub.cfg命令更新grub配置,重启后网卡名即修改成功
eth0静态ip配置
  • vi /etc/sysconfig/network-scripts/ifcfg-eth0
  • 详细配置如下所示
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
制作本地yum源
  • 新建/mnt/iso /mnt/dvd /mnt/dvdiso目录
  • CentOS-7-x86_64-Everything-1611.iso文件拷贝纸/mnt/iso目录
  • 挂载:mount -o loop /mnt/iso/CentOS-7-x86_64-Everything-1611.iso /mnt/dvdiso/
  • 拷贝:cp -a /mnt/dvdiso/* /mnt/dvd/
  • 排序:cp /mnt/dvd/TRANS.TBL /mnt/dvd/TRANS.TBL_bk和sort /mnt/dvd/TRANS.TBL_bk > /mnt/dvd/TRANS.TBL
  • 删除:rm -rf /mnt/dvd/TRANS.TBL_bk
  • 取消挂载:umount /mnt/dvdiso
  • 删除:rm -rf /mnt/iso和rm -rf /mnt/dvdiso
  • /mnt/dvd可以作为本地yum源
  • 备份yum配置:cd /etc/yum.repos.d和rename .repo .repo.bak *.repo
  • 新的yum配置:vi /etc/yum.repos.d/Centos-Media.repo
  • 更新yum源:yum clean all和yum upgrade
[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/dvd
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
本地yum源验证
  • yum install net-tools
  • yum install gcc
  • yum install gcc-c++
  • yum install glibc-static 安装c的静态库
  • yum install glibc-devel
  • yum install xulrunner.i686 安装32位程序运行库
  • yum install keepalived
  • yum install boost boost-devel boost-doc 安装boost
  • yum install kernel
  • yum install kernel-devel kernel-doc 安装内核源码
  • keepalived配置文件:vi /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
    router_id node_centos73
}
vrrp_script check_script {
    script "/root/this_is_check.sh"
    interval 60
    weight -10
}
vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 73
    priority 150
    nopreempt
    advert_int 3
    track_interface {
        eth0
    }
#    track_script {
#        check_script
#    }
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.1.101/24 brd 192.168.1.255 dev eth0 ! gateway 192.168.1.1
    }
#    notify_master "/root/you_are_master.sh"
#    notify_backup "/root/you_are_backup.sh"
#    notify_fault  "/root/you_are_fault.sh"
}

你可能感兴趣的:(开发环境搭建)