documentazione_3di_riservata:manuali_sysadmin:linuxreposerver
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Prossima revisione | Revisione precedente | ||
documentazione_3di_riservata:manuali_sysadmin:linuxreposerver [2018/09/24 14:34] – creata epapakroni | documentazione_3di_riservata:manuali_sysadmin:linuxreposerver [Data sconosciuta] (versione attuale) – eliminata - modifica esterna (Data sconosciuta) 127.0.0.1 | ||
---|---|---|---|
Linea 1: | Linea 1: | ||
- | ====== To Set a Network Repository Server on CentOS 7 ====== | ||
- | |||
- | |||
- | |||
- | ===== To Set Up the Repository ===== | ||
- | |||
- | * Elenco puntatoHere we are going to set in HTTP, so we need to install the httpd package first. | ||
- | |||
- | <code xml> | ||
- | Loaded plugins: fastestmirror, | ||
- | Loading mirror speeds from cached hostfile | ||
- | * base: centos.excellmedia.net | ||
- | * extras: centos.excellmedia.net | ||
- | * updates: centos.excellmedia.net | ||
- | Resolving Dependencies | ||
- | --> Running transaction check | ||
- | . | ||
- | . | ||
- | . | ||
- | Installed: | ||
- | httpd.x86_64 0: | ||
- | Dependency Installed: | ||
- | apr.x86_64 0: | ||
- | |||
- | Complete!</ | ||
- | |||
- | |||
- | Run the following command to create directory, for the repository server | ||
- | |||
- | [root@linuxhelp ~]# mkdir / | ||
- | |||
- | |||
- | Now initialize the database by installing createrepo | ||
- | |||
- | [root@linuxhelp ~]# yum install createrepo -y | ||
- | Loaded plugins: fastestmirror, | ||
- | Loading mirror speeds from cached hostfile | ||
- | * base: centos.excellmedia.net | ||
- | * extras: centos.excellmedia.net | ||
- | * updates: centos.excellmedia.net | ||
- | Resolving Dependencies | ||
- | --> Running transaction check | ||
- | . | ||
- | . | ||
- | . | ||
- | Updated: | ||
- | createrepo.noarch 0: | ||
- | |||
- | Complete! | ||
- | |||
- | |||
- | Run the following command to start the database. | ||
- | |||
- | [root@linuxhelp ~]# createrepo / | ||
- | Saving Primary metadata | ||
- | Saving file lists metadata | ||
- | Saving other metadata | ||
- | Generating sqlite DBs | ||
- | Sqlite DBs complete | ||
- | [root@linuxhelp ~]# ls -l / | ||
- | total 4 | ||
- | drwxr-xr-x. 2 root root 4096 Apr 27 17:44 repodata | ||
- | [root@linuxhelp ~]# ls -l / | ||
- | total 28 | ||
- | -rw-r--r--. 1 root root 586 Apr 27 17:44 01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523-filelists.sqlite.bz2 | ||
- | -rw-r--r--. 1 root root 123 Apr 27 17:44 401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz | ||
- | -rw-r--r--. 1 root root 1131 Apr 27 17:44 5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945-primary.sqlite.bz2 | ||
- | -rw-r--r--. 1 root root 123 Apr 27 17:44 6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz | ||
- | -rw-r--r--. 1 root root 575 Apr 27 17:44 7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4-other.sqlite.bz2 | ||
- | -rw-r--r--. 1 root root 134 Apr 27 17:44 dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gz | ||
- | -rw-r--r--. 1 root root 2962 Apr 27 17:44 repomd.xml | ||
- | |||
- | |||
- | To Upgrade the Repository | ||
- | |||
- | Upgrade the server repository either by using Internet or do it manually using CentOS 7 installation DVD. | ||
- | |||
- | To upgrade it via internet, go to the CentOS download mirror and choose any link. | ||
- | |||
- | CentOS | ||
- | |||
- | Now choose your Version. In my case its Version 7. | ||
- | |||
- | applications | ||
- | |||
- | Open the OS directory, choose the required architecture and copy the link to download to the newly created directory inside the server. | ||
- | |||
- | mirror list | ||
- | firefox web | ||
- | |||
- | Now use the rsync command to transfer the contents to newly created directory inside the server. | ||
- | |||
- | [root@linuxhelp ~]# rsync -avz rsync:// | ||
- | --------------------------------------------- | ||
- | Fibergrid Open Source Projects Mirror | ||
- | Hyderabad, India | ||
- | -------------------------------------------- | ||
- | |||
- | receiving incremental file list | ||
- | ./ | ||
- | .discinfo | ||
- | .treeinfo | ||
- | . | ||
- | . | ||
- | EFI/ | ||
- | EFI/ | ||
- | EFI/ | ||
- | LiveOS/ | ||
- | LiveOS/ | ||
- | |||
- | |||
- | Use the following command to check the disk space after completing the download process. | ||
- | |||
- | [root@linuxhelp ~]# du -sch / | ||
- | 4.0K / | ||
- | 6.0M / | ||
- | 4.0K / | ||
- | 20K / | ||
- | . | ||
- | . | ||
- | 4.0K / | ||
- | 4.0K / | ||
- | 4.0K / | ||
- | 4.0G total | ||
- | |||
- | |||
- | Repositories database needs to be updated. | ||
- | |||
- | [root@linuxhelp ~]# createrepo --update / | ||
- | Spawning worker 0 with 3538 pkgs | ||
- | Workers Finished | ||
- | Saving Primary metadata | ||
- | Saving file lists metadata | ||
- | Saving other metadata | ||
- | Generating sqlite DBs | ||
- | Sqlite DBs complete | ||
- | |||
- | |||
- | Now start and enable the httpd service and open the port for HTTP in firewall using the following commands. | ||
- | |||
- | [root@linuxhelp ~]# systemctl start httpd | ||
- | [root@linuxhelp ~]# systemctl enable httpd | ||
- | ln -s '/ | ||
- | [root@linuxhelp ~]# systemctl status httpd | ||
- | httpd.service - The Apache HTTP Server | ||
- | | ||
- | | ||
- | Docs: man: | ||
- | | ||
- | Main PID: 40790 (httpd) | ||
- | | ||
- | | ||
- | ?? | ||
- | ?? | ||
- | ?? | ||
- | ?? | ||
- | ?? | ||
- | ?? | ||
- | |||
- | Apr 27 18:44:24 linuxhelp httpd[40790]: | ||
- | Apr 27 18:44:24 linuxhelp httpd[40790]: | ||
- | Apr 27 18:44:24 linuxhelp systemd[1]: Started The Apache HTTP Server. | ||
- | Hint: Some lines were ellipsized, use -l to show in full. | ||
- | |||
- | |||
- | |||
- | [root@linuxhelp ~]# firewall-cmd --permanent --add-service=http | ||
- | success | ||
- | [root@linuxhelp ~]# firewall-cmd --reload | ||
- | success | ||
- | |||
- | |||
- | Use the browser to verify the contents in the directory. | ||
- | |||
- | index | ||
- | To Configure the Client Machine | ||
- | |||
- | In the / | ||
- | |||
- | [root@linuxhelp ~]# vim / | ||
- | |||
- | |||
- | Add the following lines to the configuration file. | ||
- | |||
- | [Network] | ||
- | name=Network repo | ||
- | baseurl=http:// | ||
- | enabled=1 | ||
- | gpgcheck=0 | ||
- | |||
- | |||
- | Then clean and update the repository file. | ||
- | |||
- | [root@linuxhelp ~]# yum clean all | ||
- | Loaded plugins: fastestmirror, | ||
- | Cleaning repos: network | ||
- | Cleaning up everything | ||
- | Cleaning up list of fastest mirrors | ||
- | [root@linuxhelp ~]# yum update all | ||
- | Loaded plugins: fastestmirror, | ||
- | network | ||
- | network/ | ||
- | Determining fastest mirrors | ||
- | No Match for argument: all | ||
- | No package all available. | ||
- | No packages marked for update | ||
- | [root@linuxhelp ~]# yum repolist all | ||
- | Loaded plugins: fastestmirror, | ||
- | Loading mirror speeds from cached hostfile | ||
- | repo id repo name status | ||
- | network | ||
- | repolist: 3,538 | ||
- | |||
- | |||
- | The repo which is created is displayed in the above output. Now install any package to check the repository is working fine or not. | ||
- | |||
- | [root@linuxhelp ~]# yum install httpd -y | ||
- | Loaded plugins: fastestmirror, | ||
- | Loading mirror speeds from cached hostfile | ||
- | Resolving Dependencies | ||
- | --> Running transaction check | ||
- | ---> Package httpd.x86_64 0: | ||
- | . | ||
- | . | ||
- | . | ||
- | Installed: | ||
- | httpd.x86_64 0: | ||
- | Dependency Installed: | ||
- | apr.x86_64 0: | ||
- | |||
- | Complete! | ||
- | |||
- | |||
- | The httpd package is installed from the server not from the internet. | ||
- | |||
- | |||
- | To Keep the Repository up-to-date | ||
- | |||
- | To keep the repositories up-to-date, set a cronjob by using rsync command to keep synchronizing new packages from the CentOS mirror server. | ||
- | |||
- | [root@linuxhelp ~]# crontab -e -u root | ||
- | no crontab for root - using an empty one | ||
- | crontab: installing new crontab | ||
- | |||
- | |||
- | Now add the following entry to the crontab file and save it to set a cronjob at every day morning 8:30 AM. | ||
- | |||
- | |||
- | 30 8 * * * rsync -avz rsync: http:// | ||
/data/attic/documentazione_3di_riservata/manuali_sysadmin/linuxreposerver.1537792454.txt.gz · Ultima modifica: 2018/09/24 14:34 da epapakroni