今天有朋友问我,说他搭建cloudstack测试环境,但是安装包不太好下,要一个个手动去wget,我就问他,几个包可以这么做,要很多包咋办,其实我们在同步远程一些安装包的时候,通常会用到reposync这个命令,本篇文章也是通过这条命令来下载cloudstack安装包:
1、配置selinux为disabled
[root@cloudstack1 ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
2、配置yum的repo文件
[root@cloudstack1 ~]# yum -y createrepo yum-utils [root@cloudstack1 ~]# cat /etc/yum.repos.d/cloudstack.repo [cloudstack] name=cloudstack baseurl=http://mirrors.cloudstack-china.com/mirror/centos7/4.9 gpgcheck=0 enable=1
3、同步cloudstack镜像
[root@cloudstack1 ~]# mkdir -p /mnt/yum [root@cloudstack1 ~]# cd /mnt/yum [root@cloudstack1 ~]# yum repolist Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile repo id repo name status cloudstack cloudstack 6 repolist: 6 [root@cloudstack1 yum]# reposync -r cloudstack cloudstack-agent-4.9.0-1.el7.centos.x86_64.rpm | 69 MB 00:01:21 cloudstack-baremetal-agent-4.9.0-1.el7.centos.x86_64.rpm | 5.2 kB 00:00:00 cloudstack-cli-4.9.0-1.el7.centos.x86_64.rpm | 37 kB 00:00:00 cloudstack-common-4.9.0-1.el7.centos.x86_64.rpm | 76 MB 00:00:44 cloudstack-management-4.9.0-1.el7.centos.x86_64.rpm | 101 MB 00:01:29 cloudstack-usage-4.9.0-1.el7.centos.x86_64.rpm 说明:reposync -r cloudstack,cloudstack是repo id | 64 MB 00:16:57 [root@cloudstack1 yum]# du -sh cloudstack 311Mcloudstack
4、如何添加下载的包到yum源
[root@cloudstack1 ~]# cd /mnt/yum/ [root@cloudstack1 yum]# createrepo cloudstack Spawning worker 0 with 2 pkgs Spawning worker 1 with 2 pkgs Spawning worker 2 with 1 pkgs Spawning worker 3 with 1 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete [root@cloudstack1 cloudstack]# ls cloudstack-agent-4.9.0-1.el7.centos.x86_64.rpm cloudstack-cli-4.9.0-1.el7.centos.x86_64.rpm cloudstack-management-4.9.0-1.el7.centos.x86_64.rpm repodata cloudstack-baremetal-agent-4.9.0-1.el7.centos.x86_64.rpm cloudstack-common-4.9.0-1.el7.centos.x86_64.rpm cloudstack-usage-4.9.0-1.el7.centos.x86_64.rpm 说明:从上面的输出可以知道,生成了一个repodata的文件夹。 [root@cloudstack1 cloudstack]# yum clean all Loaded plugins: fastestmirror, priorities Cleaning repos: cloudstack Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos Cleaning up list of fastest mirrors [root@cloudstack1 cloudstack]# yum makecache Loaded plugins: fastestmirror, priorities cloudstack | 2.9 kB 00:00:00 (1/3): cloudstack/filelists_db | 12 kB 00:00:00 (2/3): cloudstack/other_db | 1.7 kB 00:00:00 (3/3): cloudstack/primary_db | 10 kB 00:00:00 Determining fastest mirrors Metadata Cache Created [root@cloudstack1 cloudstack]# yum -y install cloudstack-management
到此,安装配置完成
原文地址:http://blog.51cto.com/molewan/2091230