May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

RedHat Linux 7 build yum source server

RedHat Linux 7 build yum source server

1. Create a new directory

mkdir -p /var/www/rhel7.1/x86_64/{isos,dvd}/

2. Upload RedHat installation CD image, path after uploading the

/var/www/rhel7.1/x86_64/isos/rhel-server-7.1-x86_64-dvd.iso

3. Set the boot automatically mount the CD image to /var/www/rhel7.1/x86_64/dvd
echo “/var/www/rhel7.1/x86_64/isos/rhel-server-7.1-x86_64-dvd.iso /var/www/rhel7.1/x86_64/dvd iso9660 loop,ro 0 0” >> /etc/fstab

mount -a
4. build http server (nginx), is used to access the network yum source
rpm -ivh http://nginx.org/packages/CentOS/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

# yum -y install nginx

5. Create yum source website (http://content.example.com) profile

vi /etc/nginx/conf.d/repo.rmohan.com.conf

server {
listen 80;
server_name repo.rmohan.com;

access_log /var/log/nginx/repo.rmohan.com.access.log combined;

location / {
root /content;
index index.html index.htm;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

6. Add a DNS record to the /etc/hosts file

echo “192.168.1.25 repo.rmohan.com” >> /etc/hosts
7. The opening of the firewall

# firewall-cmd –permanent –add-service http

# firewall-cmd –reload

8. Modify SELinux type Web Directory

chcon -t public_content_t -R /content/

9. Set nginx service boot from the start, and start nginx service

# systemctl enable nginx
# systemctl start nginx

10. Create a repo file

# Vi /etc/yum.repos.d/rhel-dvd.repo

[rhel-dvd]
name=remote ipa copy of dvd
baseurl=http://repo.rmohan.com/rhel7.1/x86_64/dvd
gpgcheck=0
enabled=1

11. Generate repo cache, to test whether the entry into force of the new yum source

#yum makecache

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>