Disable Firewalld Service
# systemctl disable firewalld
# systemctl stop firewalld
SELinux Change Enforcing to disabled
- Check File
# ls -la /etc/sysconfig/selinux lrwxrwxrwx. 1 root root 17 Jan 26 13:18 /etc/sysconfig/selinux -> ../selinux/config
- Disable SELinux
# sed 's/SELINUX=enforcing/SELINUX=disabled/g' -i /etc/sysconfig/selinux
Install Requirement Packages
# yum -y install createrepo yum-utils httpd
Copy RPM Packages from CD-ROM
# mount /dev/cdrom /mnt/
# mkdir -p /ISO/7/x86_64/Packages
# cp -R /mnt/Packages/* /ISO/7/x86_64/Packages/
Assign Appropriate Permissons Local Repo Directory
# chown -R root.root /ISO/7/x86_64/
Generate Repo Metadata
- Use
createrepo
command to generate repo metadata# createrepo -v /ISO/7/x86_64/ # chmod -R o-w+r /ISO/7/x86_64/
Create Repo File In /etc/yum.repos.d/local.repo
- local.repo on Repository Server
[ISO] name="RHEL 7.4 Repostitory" baseurl="file:///ISO/7/x86_64" enabled=1 gpgcheck=0 priority=1
Download EPEL Repository
- Use
reposync
to download remote epel repository, if you want to update remote repository, also use it.# reposync -n --repoid=EPEL -p / --download-metadata
- Update repository metadata
# createrepo /EPEL/ -g 66b8680793d983f01395176215ae7c5291578797ed3e327dfb65e9880d0de49e-comps-Everything.x86_64.xml
- Now you should create cronjob for daily update ( Recommand )
Setting Apache Server
- Directory Struture By Defaults
# tree /etc/httpd/ /etc/httpd/ ├── conf │ ├── httpd.conf │ └── magic ├── conf.d │ ├── autoindex.conf │ ├── README │ ├── userdir.conf │ └── welcome.conf ├── conf.modules.d │ ├── 00-base.conf │ ├── 00-dav.conf │ ├── 00-lua.conf │ ├── 00-mpm.conf │ ├── 00-proxy.conf │ ├── 00-systemd.conf │ └── 01-cgi.conf ├── logs -> ../../var/log/httpd ├── modules -> ../../usr/lib64/httpd/modules └── run -> /run/httpd
- Backup
welcome.conf
we don't need it.# mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak
- Create
/etc/httpd/conf.d/yum_repo.conf
ServerAdmin root@server.deepsoft.com ServerName mirror.nobody.com.tw DocumentRoot "/var/www/html/Repo" Options Indexes FollowSymLinks Order allow,deny Allow from all AllowOverride None Options None Order allow,deny Allow from all - Create Symbolic Link to
/var/www/html/Repo
# ln -s /ISO /var/www/html/Repo/ # ln -s /EPEL /var/www/html/Repo/
- Now start apache server
# systemctl enable httpd # systemctl start httpd.service
On The Other Servers Settings
- Edit
/etc/yum.repos.d/local.repo
[ISO] name="RHEL 7.4 Repostitory" baseurl="http://10.64.32.57/ISO/7/x86_64" enabled=1 gpgcheck=0 priority=1 [EPEL] name="RHEL 7.4 Repostitory" baseurl="http://10.64.32.57/EPEL/" enabled=1 gpgcheck=0 priority=2
Reference:
- How to create a local mirror of the latest update for Red Hat Enterprise Linux 5, 6, 7 without using Satellite server?
- How to create a local repository for updates
- How to setup Apache httpd to host a git repo via "smart" HTTP & HTTPS with user auth
- CentOS / RHEL : How to create and host yum repository over httpd
- Create internal repository server on CentOS 7
- Centos7通过reposync搭建本地Yum源
沒有留言:
張貼留言