# Migrating data from centos 7 to ubuntu

**URL:** <https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423>\
**Category:** Administrators\
**Created:** [February 27, 2024, 9:15am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423 "2024-02-27T09:15:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [February 27, 2024, 9:15am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/1 "2024-02-27T09:15:15Z")

</div>

Hi  
I want to migrate all my server data centos7 OS to ubuntu, is anything that could be problem?

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [February 27, 2024, 9:36am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/2 "2024-02-27T09:36:02Z")

</div>

No, that’s pretty straightforward.

Do a `pg_dump` to backup your database, copy the `/opt/indico/archive` folder and possibly your `/opt/indico/etc/indico.conf` and `/opt/indico/logs/` (if you want to keep that) as well.

Then on the new system you follow the installation guide but after creating the database you `pg_restore` it and DO NOT run `indico db prepare` (nor `indico setup wizard`, unless you want to regenerate your indico.conf which is probably faster than copying it if you didn’t customize anything in there).

---

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [February 28, 2024, 12:20am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/3 "2024-02-28T00:20:06Z")

</div>

thanks for reply

---

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [June 27, 2024, 8:15am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/4 "2024-06-27T08:15:02Z")

</div>

I’d made backup.sql file by pg\_dump, then I wan to use pg\_restore with my sql file, but dont know how.  
And should I copy archive, etc and logs directory before excute pg\_restore or later?  
Also, I understand excute command `systemctl restart` for launch Indico without `indico db prepare` is that right?

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [June 27, 2024, 8:22am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/5 "2024-06-27T08:22:18Z")

</div>

It would be easier to help you if you showed the exact `pg_dump` command you used (it can output dumps in different formats, and depending on the format restoring them requires different commands).

> Also, I understand excute command `systemctl restart` for launch Indico without `indico db prepare` is that right?

`systemctl restart` is not a complete command. But you are right that you must not run `indico db prepare` - you restore your DB dump instead.

---

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [June 27, 2024, 9:19am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/6 "2024-06-27T09:19:59Z")

</div>

Only know that my predecessor use  
`pg_dump` command in the centOS, and not be able to know exact options he used.(he said he don’t remember but might he used it only in basic way)  
he left `backup.sql` file and directory which is `/archive/`, `/etc/` and others under `/opt/indico/`.

I finished all steps before ‘6.Configuring Indico’ at [Apache — Indico 3.3.3 documentation](https://docs.getindico.io/en/stable/installation/production/deb/apache/) which is `indico setup wizard`  
in the Ubuntu 22 LTS.  
I even want to know should I use pg\_restore before use `indico setup wizard` command.

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [June 27, 2024, 9:25am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/7 "2024-06-27T09:25:01Z")

</div>

Can you post the first 20 lines of the backup.sql file? Easiest way to get them is running this command: `head -n 20 backup.sql`

> I even want to know should I use pg\_restore before use `indico setup wizard` command.

Doesn’t matter. The database is not accessed at that point besides testing whether it exists (but you should have already _created_ the database itself using the `createdb` command from the setup guide anyway, so that’ll be fine)

---

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [June 27, 2024, 9:44am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/8 "2024-06-27T09:44:49Z")

</div>

here is backup.sql’s

```auto
--
-- PostgreSQL database dump
--

-- Dumped from database version 13.15
-- Dumped by pg_dump version 13.15

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: attachments; Type: SCHEMA; Schema: -; Owner: indico

```

also there is the way to use this backup file to nginx? The backup files were generated from apache.

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [June 27, 2024, 9:48am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/9 "2024-06-27T09:48:19Z")

</div>

`psql indico -f backup.sql` should work. Errors regarding ownership can be ignored (since you’ll execute it as the `indico` user no explicit ownership changes are needed/possible).

And yes, it will work regardless of infrastructure choices such as apache vs nginx or the operation system.

---

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [June 27, 2024, 9:58am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/10 "2024-06-27T09:58:13Z")

</div>

Thanks for your helps a lot.

There are some things to check,  
so is it ok to use `psql indico -f backup.sql` after using command `indico setup wizard` ?  
And I was thinking I should use `chown -R /opt/indico indico`(the backup directories) for indico(the account by `useadd`) about ownership problem isnt that right?

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [June 27, 2024, 10:06am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/11 "2024-06-27T10:06:02Z")

</div>

Yes, you can run it at any time.

And yes, all the folders inside `/opt/indico` should be owned by the Indico user. Generally it is a good idea to preserve permissions when backing up and restoring files… For the directories you can check the `chmod` commands from the setup guide.

---

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [June 27, 2024, 10:24am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/12 "2024-06-27T10:24:30Z")

</div>

Also, Shoul I excute `psql indico -f backup.sql` under indico account? or root?  
Thanks again.

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [June 27, 2024, 10:26am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/13 "2024-06-27T10:26:20Z")

</div>

Run it as the indico user.

---

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [June 27, 2024, 11:27am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/14 "2024-06-27T11:27:42Z")

</div>

I’ve done all steps above, and there were no errors.  
but there’s a problem like this:

 ![image](https://talk.getindico.io/uploads/default/original/2X/9/95f05276c6505944ee0dc33f5f70f4cb814d220c.png)  
after using comman `pspl`,  
I coppied `archive/`, `cahce/`, `log/`, `logs/` and ‘tmp/’ to the new `/opt/indico`.  
and I did not copy `etc` and `web`(`etc`has same contents already and if I copy `web` the server does not work)  
and afterall I used  
`systemctl restart nginx.service indico-celery.service indico-uwsgi.service`  
`systemctl enable nginx.service postgresql.service redis-server.service indico-celery.service indico-uwsgi.service`  
to launch indico, and there were no error massages. but still I got this problem.  
what can I do for solving this problem?

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [June 27, 2024, 11:29am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/15 "2024-06-27T11:29:21Z")

</div>

Sounds like you did not run `indico db upgrade` to apply the database upgrades.

---

<div class="post-metadata">

**Author:** ![s12x919](https://talk.getindico.io/user_avatar/talk.getindico.io/s12x919/32/1503_2.png) [@s12x919](https://talk.getindico.io/u/s12x919)\
**Post date:** [June 27, 2024, 11:35am UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/16 "2024-06-27T11:35:57Z")

</div>

it works after run `indico db upgrade`,  
Thank you for all your helps  
Thanks again.

---

<div class="post-metadata">

**Author:** ![jihunee17](https://talk.getindico.io/user_avatar/talk.getindico.io/jihunee17/32/1606_2.png) [@jihunee17](https://talk.getindico.io/u/jihunee17)\
**Post date:** [June 27, 2024, 12:47pm UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/17 "2024-06-27T12:47:12Z")

</div>

Dear ThiefMaster,  
I’m the same user above(username ‘치환’),  
afterall, can use the server and the backup was successful but still I cannot modifying its contents  
so, on the web

 ![image](https://talk.getindico.io/uploads/default/original/2X/d/d2b707cf9ab9c3d81512c638cee2d7b65d09b1ce.png)

I cannot click those buttons with red square, using admin account and cannot log off also

for your information, I moved the server from Apache, CentOS to Nginx, Ubuntu.

and downloading pdf files also give 403 Forbidden.

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [June 27, 2024, 12:51pm UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/18 "2024-06-27T12:51:52Z")

</div>

Most likely loading JS fails. Open one of the urls to those files (check “view source” to get the urls) directly and see what error you get. Also check the nginx/apache error log.

Most likely permissions e.g. for the /opt/indico/cache folder are broken.

---

<div class="post-metadata">

**Author:** ![jihunee17](https://talk.getindico.io/user_avatar/talk.getindico.io/jihunee17/32/1606_2.png) [@jihunee17](https://talk.getindico.io/u/jihunee17)\
**Post date:** [June 27, 2024, 1:09pm UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/19 "2024-06-27T13:09:23Z")

</div>

The error is `(13: Permission denied)`,  
so I trying to change user setting(now it is `user www-data;`) in `etc/nginx/nginx.conf`,  
what should I use for the user name? or any other solutions exist?

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [June 27, 2024, 1:15pm UTC](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423/20 "2024-06-27T13:15:23Z")

</div>

Please do not post incomplete log messages, it would have been helpful to know the file/path where permission was denied. Anyway, if you get permission denied, then my guess would be that the nginx group (usually `www-data`) cannot access the relevant indico files.

Confirm that:

- `/opt/indico` is owned by `indico:www-data` and has has at least the x bit set for group permissions
- files that actually need to be read by nginx (such as the ones in cache, tmp and archive) of course need to be group-readable as well (x on directories just allows entering them)

If you still need help, please get the full path to the file where access is denied, and then show me the output of `ls -ld` commands like this:

```auto
ls -ld /opt/indico/whatever/something/file.xyz
ls -ld /opt/indico/whatever/something
ls -ld /opt/indico/whatever
ls -ld /opt/indico

```

[Next page](https://talk.getindico.io/t/migrating-data-from-centos-7-to-ubuntu/3423.md?page=2)
