In the cluster, a number of servers, all manually installed, the equivalent of a great time, this is not realistic. (no outside the net) guiding ideology
Thought one, each machine is equipped with a local file system on the Yum warehouse file:///packege/path/. (few servers can be taken)
Thought two, the local file system that configures a node (server-base) inside the LAN Yum Warehouse, then publishes it to the Web server, the other node can download to this machine through http://server-base/pagekege/path/. establishment of local Yum warehouse
Production process: First select a machine mini4, mount a system CD to the local directory/mnt/cdrom, and then start a httpd server,/mnt/cdrom Soft connection to the HTTPD directory/var/www/html server (cd/var/www/ html Ln-s/mnt/cdrom./centos)
Then through the Web Access test: Http://mini4/centos will see the contents of the CD. At this point: Network version Yum private Warehouse has been established. The rest is to go to each Yum client configures this HTTP address to the repo configuration file.
The order is as follows:
Mkdir/mnt/cdrom #创建挂在的目录
Mount-t iso9660-o ro/dev/cdrom/mnt/cdrom #把安装的镜像文件挂载到自定义的/mnt/cdrom
Note that if this is so manual mount, each reboot after the need to mount once more (to see if there is content under the/dev/cdrom CD, VM virtual machine, click the virtual Machine right button to see the setting, see whether the mirror selection and connect is checked), this is certainly not needed, Allows the Linux system to mount automatically: add a one-line mount configuration to the/etc/fstab and mount it automatically:
VI /etc/fstab
Then add the last line:
/dev/cdrom /mnt/cdrom iso9660 defaults
Then the Yum local warehouse was created:
cd/etc/yum.repos.d/
Rename. Repo. Repo.bak * #把所有的默认的库都变成备份
CP Centos-media.repo.bak Centos-mini03.repo #创建新的yum库
VI Centos-mini03.repo
The configuration is as follows:
[MINI03]
name=centos-mini03
baseurl=file:///mnt/cdrom #挂载的地址
gpgcheck=1
enabled=1 #很重要, 1 only enabled
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
Yum Common commands:
Install httpd and confirm installation
yum instll-y httpd
list all available package and package groups
Yum list
Clear all buffered data yum clean all
lists a package for all dependent packages
Yum deplist httpd
Delete httpd
yum remove httpd
When the CENTOS-MINI03.REPO is configured, execute the following command:
Yum Clean all #清除所有yum库
yum repolist #重新加载yum库
The above mount is a mirror of the system, this image has a lot of installation files, because we installed minimal, so most of the software is required to manually install, there is a httpd static Web server, you can provide downloads, the following to install HTTPD:
Yum install-y httpd
service httpd start
Use the browser to access http://mini03 (if access is not available, check whether the firewall has 80 ports turned on or shut down the firewall)
From this we can see that our Yum local warehouse has been installed successfully, and the HTTPD service has been started.
The following mount is followed by the above load operation:
Because httpd static files can be accessed by the external server in the/var/www/html directory, all we need is a soft connection to the mount path under this directory:
cd/var/www/html
ln-s/mnt/cdrom./centos
From this, you can see the following:
Here, I don't have your yum. local library, httpd, mount image file mount is complete. installation of JDK
Refer to the local library installation above mini03, you can change the local library of mini02,mini04,mini05,mini06 (this place is http://mini03/centose rather than local file:///mnt/cdrom), After the modification is complete, we begin to write the Scripting install cluster installed, which should be noted that each machine must have an SCP installation, if there is no need to install the SCP:
Yum Install-y openssh-clients
Figure two scripts under mini03 and add X (execute) permissions
Boot.sh's script is as follows: (SSH public and private key generation: Ssh-keygen)
The install_jdk.sh script is as follows:
The text reads as follows:
boot.sh
#!/bin/bash
servers= "mini02 mini03 mini04 mini05 mini06"
password=123456
base_server=mini03
auto_ ssh_copy_id () {
expect-c "set timeout-1;
Spawn Ssh-copy-id $;
expect{
* (yes/no) * {send-yes\r;exp_continue;}
*assword:* {send-$2\r;exp_continue;}
EOF {exit:0}}
';
}
Ssh_copy_id_to_all () {for
SERVER in $SERVERS
does
auto_ssh_copy_id $SERVER $PASSWORD
done
}
Ssh_copy_id_to_all for
SERVER in $SERVERS
do
SCP install_jdk.sh root@ $SERVER:/root
SSH root@ $SERVER/root/install_jdk.sh Done
install_jdk.sh
#!/bin/bash
base_server=mini03
yum install-y wget wget
$BASE _server/soft/jdk-7u45-linux-x64.tar.gz
tar-zxvf jdk-7u45-linux-x64.tar.gz-c/usr/local
cat >>/etc/profile << EOF
export Java_ home=/usr/local/jdk1.7.0_45
export path=\ $PATH: \ $JAVA _home/bin
EOF
source/etc/profile
The
is finally executed in the mini03./boot.sh installation, which can finally be viewed with java-version on each machine