wiki:CentOS_6_YUM

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

CentOS 6 KVM

## 安装KVM
yum install kvm qemu-kvm python-virtinst libvirt libvirt-python virt-manager libguestfs-tools policycoreutils-python bridge-utils

## ifcfg-br0
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=10.1.1.3
NETMASK=255.255.255.0

## ifcfg-eth0
DEVICE=eth0
HWADDR=F8:BC:12:46:B9:B9
TYPE=Ethernet
BRIDGE=br0
UUID=5bf0bd52-9408-4782-b2dc-eb2427c75339
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none

## wget http://mirrors.163.com/centos/6/isos/x86_64/CentOS-6.7-x86_64-minimal.iso
mkdir -p /opt/kvm && qemu-img create -f qcow2 /opt/kvm/template.qcow2 22G

virt-install \
--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

virt-clone \
--original template \
--name test101 \
--file /opt/kvm/test101.qcow2

Last modified 7 years ago Last modified on 02/24/16 23:48:50