Create Local Yum Repository Server on CentOS 7
Here you will understand that how to create a local YUM repository server on CentOS 7. By the use of local YUM repository server, client machines can install the require rpm packages easily without internet access. Yum stands for Yellow dog updater modified, actually Yum is a local repository for RPM Packages. By use of Yum, dependencies of any packages is automatically install. Yum is a tool for the use of installing, upgrading, querying, managing and getting rpm software packages of Red Hat, CentOS, Oracle Enterprise Linux and etc.
Configuration of Server Machine:
Give a suitable name for local Yum repository server, here we have given the server name "repository-server". To check the name of server inside file "hostname" in directory "/etc", type the following command.
cat /etc/hostname
To check the IP configuration of CentOS Linux local YUM Repository Server, type the below mention command. This command is also works on Red Hat Enterprise Linux, Oracle Enterprise Linux and etc.
cat /etc/sysconfig/network-scripts/ifcfg-ens33
In CentOS linux, directory
"media" is used to mount the cdrom device. To check directory
"media" that is always available in root
"/", type the following command.
To check the cdrom is available in directory
"/dev", type the following command.
Mount the device "cdrom" to directory "media", type the following command.
To check the cdrom device
"/dev/sr0" is successfully mount to directory
"/media", type the following command.
df -hT
To check cdrom data has successfully mounted, first use command "cd" to enter in the directory "media" then use command "ls" to list cdrom data .
cd /media/
ls
To check the available yum repository files in directory "/etc/yum.repos.d/", type the below mention commands.
cd /etc/yum.repos.d/
ll
Create a local repository file, there is no such requirement of local repository file in server but it can be use when internet is not available. To create a local repository file in server, type the below mention command.
vi repository-server.repo
Note: you can create repository file with any suitable name, In the above image you can see that we have created repository file
"repository-server.repo".
Add the below lines in repository file "repository-server.repo".
[Packages]
Name = Repository-Server
baseurl = file:///media/
enabled = 1
gpgcheck = 0
Here,
Packages --> Repository ID.
Repository-Server --> Repository Name.
enabled = 1 --> Repository is enable.
enabled = 0 --> Repository is disable.
gpgcheck = 0 --> Signature Verification is set to disable.
After create the new repository file, type the below mention command.
To list all of the repositories, type the below mention command.
Now install the below mention packages that will be used to connect client machines with centralized repository server.
To install the package "ftp", type the below mention command.
In the above image you can see that the repository "Packages" has used for the installation of Package "FTP".Allow Service "ftp" in firewall. To allow Service "ftp" in firewall "firewalld", type the below mention command.
firewall-cmd --permanent --add-service=ftp
After add the service of "FTP" in Firewall "firewalld", reload Firewall "firewalld". To reload Firewall "firewalld", type the following command.
For security, performance and stability of FTP server install Package "vsftpd" that is FTP Server daemon. To install Package "vsftpd", type the following command.
In the above image you can see that repository "base" is being used for the installation of Package "vsftpd", because Package "vsftpd" is not available in Repository "Packages".
The Package "vsftpd" has been successfully installed.
To start the service of
"vsftpd", type the following command.
To enable the service of
"vsftpd", type the following command.
To check the status of FTP daemon "vsftpd", type the following command.
Now it is a time to create a repository directory in directory "FTP" for Linux client machine. To enter in directory "FTP", type the following command.
Create directory "centos7" in directory "ftp" by use of mkdir command.
Now copy all the data of cdrom directory
"media" to the directory
"centos7".
cp -rf /media/* /var/ftp/centos7/
To check all the data with size in directory "centos7", type the following command.
ll -alhrt /var/ftp/centos7/
Configuration of Client Machine:
To check the name of client machine inside file "hostname" in directory "/etc", type the below mention command.
To check the IP configuration of CentOS Linux client machine, type the below mention command. This command is also works on Red Hat Enterprise Linux, Oracle Enterprise Linux and etc.
cat /etc/sysconfig/network-scripts/ifcfg-ens33
Edit the file
"hosts" for add the server and client machine entries
"IP with Name", type the following command for edit the file.
Add the following lines that is client machine and server machine "IP with Name".
192.168.10.221 apache
192.168.10.219 repository-server
To check the repository file that already available in client machine repository directory "/etc/yum.repos.d/", type the following command.
cd /etc/yum.repos.d/
ls
Now remove all the repository files that available in repository directory
"/etc/yum.repos.d/", type the following command.
Create a new repository file
"centos7.repo" in yum repository directory
"/etc/yum.repos.d/", type the following command.
Add the below lines in repository file "centos7.repo".
[Packages]
Name = Repository For Client
baseurl = ftp://repository-server/centos7/
enabled = 1
gpgcheck = 0
To check the repository list in Linux client machine, type the following command.
To install the Apache Package "httpd", type the following command.
The Apache web server in Linux client machine "Apache" has been successfully installed.
Thanks for Read this Article
Comments
Post a Comment