= CentOS 6 yum & rpm = {{{ ## 更新163源,添加EPEL6 cd /etc/yum.repos.d/ mv CentOS-Base.repo CentOS-Base.repo.backup curl -o CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo rpm -ivh http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm yum makecache ## 修改默认配置 echo >>/etc/bashrc echo "alias vi=vim" >>/etc/bashrc echo "alias grep='grep --color'" >>/etc/bashrc echo "alias nt='netstat -tnlp'" >>/etc/bashrc echo "alias pf='ps -ef'" >>/etc/bashrc echo >>/etc/sysctl.conf echo "vm.swappiness = 1" >>/etc/sysctl.conf sed -i '/# End of file/i\* - nofile 65535' /etc/security/limits.conf sed -i '/# End of file/i\* - nproc 65535' /etc/security/limits.conf sed -i 's/1024/65535/g' /etc/security/limits.d/90-nproc.conf sed -i '/SELINUX/ s/enforcing/disabled/g' /etc/selinux/config chkconfig iptables off chkconfig ip6tables off chkconfig lvm2-monitor off chkconfig mdmonitor off chkconfig postfix off chkconfig restorecond off ## 工具包 yum update -y yum install -y man vim lftp ftp ntp telnet nmap rsync \ openssh-clients unzip unrar wget bind-utils \ pciutils dmidecode sysstat lrzsz nc p7zip tcpdump ## 开发库 yum install -y gcc gcc-c++ cmake autoconf libjpeg libjpeg-devel libpng libpng-devel \ freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel \ glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel \ e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel sqlite-devel \ openssl openssl-devel bison libtool-ltdl-devel mysql-devel mysql-libs \ readline-devel tk-devel ImageMagick-devel ImageMagick-c++-devel lua-devel\ libxslt-devel libxslt libxml2-devel libxml2 libffi libffi-devel libXpm libXpm-devel \ libc-client libc-client-devel libmcrypt libmcrypt-devel jemalloc-devel ## 不装桌面,仅开启X11-Forword(X-Window) yum -y install libXtst libXtst-devel xorg-x11-xauth rpm-build redhat-rpm-config ## VNC和Chrome yum groupinstall xfce yum install -y tigervnc-server yum localinstall --nogpgcheck -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm ## KVM yum install kvm qemu-kvm python-virtinst libvirt libvirt-python virt-manager libguestfs-tools policycoreutils-python bridge-utils mkdir -p /opt/kvm && qemu-img create -f qcow2 /opt/kvm/template.qcow2 22G virt-install \ --connect qemu:///system \ --virt-type kvm \ --description "Which is the template for VMs" \ --name template \ --vcpus 4 \ --ram 8192 \ --cdrom /opt/kvm/CentOS-6.7-x86_64-minimal.iso \ --os-type linux \ --os-variant rhel6 \ --disk path=/opt/kvm/template.qcow2,format=qcow2 \ --network bridge=br0 \ --graphics vnc,listen=0.0.0.0 }}}