# Migration to Rocky 8 via local files?

**URL:** <https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-8\
**Created:** [September 27, 2024, 10:19pm UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997 "2024-09-27T22:19:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wamclaughlin](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wamclaughlin](https://forums.rockylinux.org/u/wamclaughlin)\
**Post date:** [September 27, 2024, 10:19pm UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/1 "2024-09-27T22:19:28Z")

</div>

Hi:

I have a production web server that is centios stream 8 and that I need to migrate it to Rock 8 for security patches. The network configuration is such that all downloads to the server need to be done through an ssh tunnel. For example the dnf update command will work through that tunnel.

When trying to run the migratetorocky script it fails because curl is not set up to work via the tunnel. Please advise on how to proceed with the migration. Would it be possible to transfer all the required programs and files for the migration prior to starting the migration command so that it can go through the migration steps using the information downloaded locally? After the migration, all updates should work fine since the dnf update command works via the ssh tunnel.

Sincerely,

Bill M

---

<div class="post-metadata">

**Author:** ![pajamian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/pajamian/32/715_2.png) [@pajamian](https://forums.rockylinux.org/u/pajamian)\
**Post date:** [September 28, 2024, 12:53am UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/2 "2024-09-28T00:53:08Z")

</div>

Hi,

Unfortunately migrate2rocky doesn’t have an option to be able to use local repos. You would have to modify the script to be able to do so. A quick summary of what would need modifying:

The Rocky Linux GPG Key would have to be pre-downloaded and migrate2rocky modified to use that key instead of attempting to download the key itself (around lines 141 and 1279).

The repo URLs for baseos and appstream need to be modified to point to a local copy of those repositories (line 149)

The rocky\*.repo files need to be modified after they are installed to point to the local copies of the repos by adding code to do so around line 1098 (before the distrosync).

In addition to this you need to have a working local copy of the CentOS Stream 8 repos from vault and have the appropriate CentOS-Stream-\*.repo files modified to point to those local copies. You should not have to modify migrate2rocky for this step but in case you get issues it may help to modify all the centos-stream URLs from line 623.

I believe that this is all the places that need modifications but keep in mind that there may be more and it would be very easy to make a mistake which screw up the migration so make sure that you have a full backup as well as a snapshot that you can easily roll back if you decide to attempt this.

Otherwise it may be easier to just temporarily allow a proper internet connection through to the target machine and then change it back once your migration is done.

Good Luck,

Peter

---

<div class="post-metadata">

**Author:** ![wamclaughlin](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wamclaughlin](https://forums.rockylinux.org/u/wamclaughlin)\
**Post date:** [September 30, 2024, 10:13pm UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/3 "2024-09-30T22:13:44Z")

</div>

Hi Peter,

I hope you’re doing well.

I have successfully downloaded the Rocky Linux repositories and placed them in a local directory at /home/wmclaughlin/rocky8repos. Additionally, I have saved the GPG key at /home/wmclaughlin/RPM-GPG-KEY-rockyofficial.

I plan to modify the migrate2rocky.sh script with the following changes:

Replace the lines around 141 and 1279 to use the pre-downloaded GPG key:

gpg\_key\_url=“/home/wmclaughlin/RPM-GPG-KEY-rockyofficial”

Modify the repo URLs around line 149:

repo\_urls=(

```
[rockybaseos]="/home/wmclaughlin/rocky8repos/BaseOS/$ARCH/os/"

[rockyappstream]="/home/wmclaughlin/rocky8repos/AppStream/$ARCH/os/"

```

)

Add code around line 1098 to modify the rocky\*.repo files:

sed -i 's|baseurl=._|baseurl=file:/home/wmclaughlin/rocky8repos/BaseOS/|’ /etc/yum.repos.d/rocky_.repo

sed -i 's|baseurl=._|baseurl=file:/home/wmclaughlin/rocky8repos/AppStream/|’ /etc/yum.repos.d/rocky_.repo

Unfortunately, I was unable to download the CentOS Stream 8 repositories to create a local copy. I attempted to use the mirror at [https://vault.centos.org/](https://vault.centos.org/), but I was only able to retrieve a robots.txt file.

Could you please advise if the planned modifications look correct for proceeding with the migration using the local files? I am still using an intermediate machine to transfer files from the web, and I have not yet been able to establish an open internet connection on the target machine.

Thank you for your assistance.

Sincerely,

Bill

---

<div class="post-metadata">

**Author:** ![pajamian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/pajamian/32/715_2.png) [@pajamian](https://forums.rockylinux.org/u/pajamian)\
**Post date:** [October 1, 2024, 5:28am UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/4 "2024-10-01T05:28:00Z")

</div>

> [@wamclaughlin](#):
>
> I plan to modify the migrate2rocky.sh script with the following changes:
> 
> Replace the lines around 141 and 1279 to use the pre-downloaded GPG key:
> 
> gpg\_key\_url=“/home/wmclaughlin/RPM-GPG-KEY-rockyofficial”

Don’t forget that the code around line 1279 has to be modified to work with a local file instead of attempting to download from a URL.

> [@wamclaughlin](#):
>
> Modify the repo URLs around line 149:
> 
> repo\_urls=(
> 
> ```auto
> [rockybaseos]="/home/wmclaughlin/rocky8repos/BaseOS/$ARCH/os/"
> 
> [rockyappstream]="/home/wmclaughlin/rocky8repos/AppStream/$ARCH/os/"
> 
> ```
> 
> )

Local repos need to be specified with a “file:///” URL.

> [@wamclaughlin](#):
>
> Add code around line 1098 to modify the rocky\*.repo files:
> 
> sed -i 's|baseurl=._|baseurl=file:/home/wmclaughlin/rocky8repos/BaseOS/|’ /etc/yum.repos.d/rocky_.repo
> 
> sed -i 's|baseurl=._|baseurl=file:/home/wmclaughlin/rocky8repos/AppStream/|’ /etc/yum.repos.d/rocky_.repo

This will not comment out mirrorlist= lines and will leave baseurl lines commented, but modified. Also it should be file:///home/… (three slashes initially). Also these regexes will not do what you think, experiment with sed on a copy of the files first to see what they actually do.

I suggest:

```auto
sed -i \
    -e 's|^mirrorlist=|#mirrorlist=|' \
    -e 's|^#?baseurl=.*releasever/|baseurl=file:/home/wmclaughlin/rocky8repos/|'

```

> [@wamclaughlin](#):
>
> Unfortunately, I was unable to download the CentOS Stream 8 repositories to create a local copy. I attempted to use the mirror at [https://vault.centos.org/](https://vault.centos.org/), but I was only able to retrieve a robots.txt file.

There is a copy of the vault repo at [Index of /vault/centos/8-stream/](https://dl.rockylinux.org/vault/centos/8-stream/)

---

<div class="post-metadata">

**Author:** ![wamclaughlin](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wamclaughlin](https://forums.rockylinux.org/u/wamclaughlin)\
**Post date:** [October 4, 2024, 10:07pm UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/5 "2024-10-04T22:07:41Z")

</div>

Thank you for the assistance. Although I was not successful with the migration using local files on the remote server, I was able to do a fresh install of Rocky 9 there from the DVD iso. FYI dnf update no longer worked via the ssh tunnel to the remote server, possibly due to its use of curl, so we established local repos on the remote server. These are updated from repos created on a server that does have an Internet connection and transferred to the remote server using scp.

Thank you again.

Sincerely,

Bill

---

<div class="post-metadata">

**Author:** ![wamclaughlin](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wamclaughlin](https://forums.rockylinux.org/u/wamclaughlin)\
**Post date:** [October 4, 2024, 10:13pm UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/6 "2024-10-04T22:13:09Z")

</div>

Also the restic snapshot of the Centios 8 stream server was instrumental in enabling the efficient retrieval of the data and configuration files for the move of the server to Rocky 9.

---

<div class="post-metadata">

**Author:** ![pajamian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/pajamian/32/715_2.png) [@pajamian](https://forums.rockylinux.org/u/pajamian)\
**Post date:** [October 5, 2024, 7:58am UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/7 "2024-10-05T07:58:10Z")

</div>

> [@wamclaughlin](#):
>
> Although I was not successful with the migration using local files on the remote server, I was able to do a fresh install of Rocky 9 there from the DVD iso.

This is almost certainly a better solution anyways. I’m glad you got things working.

> [@wamclaughlin](#):
>
> FYI dnf update no longer worked via the ssh tunnel to the remote server,

You probably need to set the proxy config in dnf.conf appropriately. ssh supports SOCKS 4/5 proxy configs.

> [@wamclaughlin](#):
>
> These are updated from repos created on a server that does have an Internet connection and transferred to the remote server using scp.

Use rsync instead, it’s much more efficient than scp.

---

<div class="post-metadata">

**Author:** ![wamclaughlin](https://avatars.discourse-cdn.com/v4/letter/w/e9bcb4/32.png) [@wamclaughlin](https://forums.rockylinux.org/u/wamclaughlin)\
**Post date:** [October 31, 2024, 4:57pm UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/8 "2024-10-31T16:57:21Z")

</div>

As an update, to effectively enable the SSH tunnel for running `dnf update`, we added the following line to the `dnf.conf` file:

```auto
proxy=http://127.0.0.1:8081

```

Then, on the remote server, we used the following command to enable the tunnel:

```auto
ssh -N -L 8081:dl.rockylinux.org:80 user@IPconnectedtointernet

```

Additionally, we opted to use Rocky 8 to ensure compatibility with the MegaRAID version on the server.

Thank you very much for your assistance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [December 30, 2024, 4:57pm UTC](https://forums.rockylinux.org/t/migration-to-rocky-8-via-local-files/15997/9 "2024-12-30T16:57:36Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
