1. Ubuntu Sunucu
1.1. Gerekli paketleri indirmek için ubuntu 18.04 deposu /etc/apt/sources.list
'e eklenir ve apt update
komutu çalıştırılır.
echo """deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse""" >> /etc/apt/sources.list
sudo apt update
1.2. Gerekli paketler indirilir.
sudo apt install yum-utils createrepo
1.3. Oracle key'i indirilir ve İndirmek istenilen depolar debian sunucunuzdaki etc/yum/repos.d/
dizinine .repo uzantısı ile eklenir ve yum update komutu çalıştırılır.
curl https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8 -o /etc/pki/RPM-GPG-KEY-oracle
echo """[baseos]
name=Oracle Linux 8 - Base
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/
gpgcheck=0
gpgkey=file:///etc/pki/RPM-GPG-KEY-oracle""" > /etc/yum/repos.d/Oracle-Linux-8-Base.repo
echo """[appstream]
name=Oracle Linus 8 - Appstream
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/
gpgcheck=0
gpgkey=file:///etc/pki/RPM-GPG-KEY-oracle""" > /etc/yum/repos.d/Oracle-Linux-8-Appstream.repo
sudo yum update
1.4. rpm paketlerinizin indirileceği depolama alanı olşuturulur.
mkdir -p /storage/oracle-linux/8/{baseos,appstream}/x86_64/
1.5. yum.conf dosyası aşağıdaki gibi oluşturulur ve yum update çalıştırılır.
echo """[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False""" > /etc/yum.conf
sudo yum update
1.6. Depodaki paketler indirilir
reposync -g -l -d -m -a x86_64 --repoid=baseos --newest-only --download-metadata --download_path=/storage/oracle-linux/8/baseos/x86_64/ --norepopath
reposync -g -l -d -m -a x86_64 --repoid=appstream --newest-only --download-metadata --download_path=/storage/oracle-linux/8/appstream/x86_64/ --norepopath
1.7. Paketler indirildikten sonra aşağıdaki şekilde görüntülenebilmelidir.
ls -al /storage/oracle-linux/8/baseos/x86_64/getPackage/
1.8. Index dosyaları oluşturulur.
createrepo --update /storage/oracle-linux/8/baseos/x86_64/
createrepo --update /storage/oracle-linux/8/appstream/x86_64/
1.9. Depoyu yayınlayacak bir web servisi yüklenir, örneğin apache2. Sonrasında indirilen depo apache içerisine linklenir.
sudo apt install apache2
rm /var/www/html/index.html
ln -s /storage/oracle-linux /var/www/html/
2.Reposync için Crontab
2.1. Paketlerin düzenli olarak aynalanması için /etc/oracle-linux.sh adında bir dosya oluşturulur ve içerisine aşağıdaki betik yazılır
base_path=/storage/
for i in $( ls /etc/yum/repos.d/ | grep ".repo")
do
echo $i
destination_path=$(grep baseurl /etc/yum/repos.d/$i | grep -oP 'oracle-linux/(.*)' | grep -oP '/(.*)' )
destination_path=$(grep baseurl /etc/yum/repos.d/$i | grep -oP 'oracle-linux/(.*)' )
echo $base_path$destination_path
repo_id=$(grep -oP "\[\K(.*)" /etc/yum/repos.d/$i | sed 's/.$//')
echo $repo_id
reposync -g -l -d -m -a x86_64 --repoid=$repo_id --newest-only --download-metadata --download_path=$base_path$destination_path --norepopath
echo reposync -g -l -d -m -a x86_64 --repoid=$repo_id --newest-only --download-metadata --download_path=$base_path$destination_path --norepopath
createrepo $base_path$destination_path
done
2.2. Betik çalıştırışır hale getirilir.
sudo chmod +x /etc/oracle-linux.sh
2.3. sudo crontab -e
komutu çalıştırılır ve açılan metin dosyasının en sonuna aşağıdaki cron satırı eklenir.
0 5 * * * /etc/oracle-linux.sh
3.Oracle Linux 8 GPG Keyinin Web Sunucuna Eklenmesi
3.1. Deponun indirildiği oracle-linux dizinine gidilir. wget ile gpg anahtarı çekilir.
cd /storage/oracle-linux
wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8
4.Oracle Linux 8 İstemci
4.1. Oracle Linux 8 üzerinde depoyu kullanabilmek için aşağıdaki formatta .repo dosyalarına depo sunucunuzu yazmanız yeterli.
echo """[baseos]
name=Oracle Linux 8 - Base
baseurl=http://10.10.10.10/oracle-linux/8/baseos/x86_64/
gpgcheck=0
enabled=1
gpgkey=http://10.10.10.10/oracle-linux/RPM-GPG-KEY-oracle-ol8""" > /etc/yum.repos.d/Oracle-Linux-8-Base.repo
echo """[appstream]
name=Oracle Linux 8 - Appstream
baseurl=http://10.10.10.10/oracle-linux/8/appstream/x86_64/
gpgcheck=0
enabled=1
gpgkey=http://10.10.10.10/oracle-linux/RPM-GPG-KEY-oracle-ol8""" > /etc/yum.repos.d/Oracle-Linux-8-Appstream.repo
4.2. Depo güncellenerek paket kurulumu yapılabilir.
sudo yum update
Top comments (0)