1. 程式人生 > >CentOS6基礎映象製作

CentOS6基礎映象製作

掛載映象、開機自動掛載設定
# mkdir /iso
# mount -o loop /dev/sr0 /iso
# vim /etc/fstab

配置yum
# vim /etc/yum.repos.d/centos6-dvd.repo
[centos6-dvd]
name=centos6-dvd
baseurl=file:///iso
gpgcheck=0
# yum repolist all

安裝一些基礎軟體包
yum install -y vim lftp openssh-clients

關閉防火牆
# service iptables stop
# chkconfig iptables off
# chkconfig ip6tables off

禁用selinux
# vim /etc/selinux/config

設定主機名
# vim /etc/sysconfig/network
centos6 此檔案設主機名

設定本地域名解析
# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.0.60    host60
192.168.0.61    host61
192.168.0.62    host62
192.168.0.63    host63

設定網路IP
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.0.60
PREFIX=24
GATEWAY=192.168.0.1
DNS1=101.226.4.6(windows cmd ipconfig /all可查)
DNS2=114.114.114.114
DNS3=8.8.8.8
DNS4=4.4.4.4

# service network restart
# ping www.baidu.com

安裝JDK
tar -zxf jdk-8u121-linux-x64.tar.gz -C /opt/software/
cd /opt/software/
ln -s jdk1.8.0_121 java

vim /etc/profile
## SET JAVA_HOME
export JAVA_HOME=/opt/software/java
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

source /etc/profile
# java -version

三處清理
rm -rf /root/anaconda-ks.cfg  /root/install.log*
rm -rf /etc/ssh/ssh_host_*
rm -rf /etc/udev/rules.d/70-persistent-*

shutdown