Wordpress uninstall/reinstall

NethServer Version: 7.3.1611 (Final)
Module: wordpress

Hi Everyone,

Could anyone help me to uninstall/reinstall wordpress properly?

What i tried to achieve:
I tried to install wordpress as a second website with different domain name following this, this and this guides.
Example:
Main website as domainone.com
Wordpress store as domaintwo.com

What i did:

  1. Set the server alias to domainone.com and domaintwo.com under DNS.
  2. I followed the article of stephdl here and installed it successfully.
  3. Launched domaintwo.com/wordpress and started the initial setup.
  4. Under general setting i changed the URL for both WordPress Address (URL) and Site Address (URL) and then ran the appropiate commands as listed in the guide.
    Now this is where i did the first mistake that i noticed much later. I did a typo in the URL here, so worpress didnt showed up when i tried with the URL domaintwo.com and from then on i started to change things till i messed up everything properly.
    -I tried then uninstalling with yum remove nethserver-wordpress, deleting the folder /usr/share/wordpress and /etc/httpd/conf.d/wordpress.conf file.
    -After reinstalling i am still unable to either access domaintwo.com nor domaintwo.com/wordpress to correct the issue. Error is stil: Not Found

Is there anyone who could possibly help me do a proper reinstall or to correct the issue?

If you don’t need your old mysql database you must remove it for installing a fresh wordpress.

Your mysql database is still pointing to the bad url

1 Like

With phpmyadmin you can either correct the url inside the wordpress database or remove it.

Thanks for the quick reply. I would prefer to start with a fresh install. Would you mind showing me how i can remove the old database? i looked this, but couldn’t figure out. When i run a ls -al /var/lib/nethserver/db/, the wordpress database doesnt even show up in the list

@stephdl
I think i got it finally. Thoiugh i managed to access the database thanks to this post, i did a mistake again of course, and forgot that semicolon when ran SHOW DATABASES. I deleted the database using this.
Went through the package uninstall and removal as described above. Rebooted the server, just in case and ran the installation again, but the same error: Not Found.
I noticed that the folder /usr/share/wordpress got recreated, but it contains only a tmp folder. Running a search for wordpress i found another folder /etc/wordpress/ which contains only wp-config.php.
Any hints?

Remove the e-smith db before to reinstall also

config delete wordpress

@stephdl
I did the reinstall process again. It looks as follows:
yum remove nethserver-wordpress
cd /usr/share/
rm -R -f wordpress
cd /etc
rm -R -f wordpress
cd /etc/httpd/conf.d/
rm wordpress.conf
config delete wordpress
mysql -u root -p -> get the password from cat /var/lib/nethserver/secrets/mysql
show databases;
drop database wordpress;
show databases;
exit
yum install nethserver-wordpress --enablerepo=stephdl

Looks bit better cause it says this time:
Forbidden
You don’t have permission to access /wordpress/ on this server.

I ran:
ls -l /usr/share/wordpress
total 0
drwxr-x— 2 apache apache 6 Mar 29 21:20 tmp

Try with elevated privileges: sudo yum install nethserver-wordpress --enablerepo=stephdl

@robb
I am logged in to the server via SSH as root.
I am confused cause i seem to have different outputs:

1.
ls -l /usr/share/wordpress
total 0
drwxr-x— 2 apache apache 6 Mar 29 21:20 tmp

2.
stat -c “%U %G” /usr/share/wordpress
root root

Anyway, i ran:
chown -R apache:apache /usr/share/wordpress

Now the result is:
stat -c “%U %G” /usr/share/wordpress
apache apache

But it still displays the error: forbidden.

Running a search shows:
find / -name wordpress
/etc/e-smith/db/configuration/defaults/wordpress
/etc/e-smith/db/accounts/defaults/wordpress
/etc/e-smith/events/nethserver-wordpress-update/templates2expand/etc/wordpress
/etc/e-smith/templates/etc/wordpress
/etc/e-smith/templates.metadata/etc/wordpress
/var/lib/nethserver/secrets/wordpress
/var/lib/mysql/wordpress
/usr/share/wordpress

do i have to set permission on a different folder?

well the re-installation of your server is not far…honestly you don’t need to remove files like you did, or chown them…the yum process does it

well, if yum would have done it’s job properly, i wouldn’t have come to the idea to remove any file, chown, etc…, or use cli at all. Reinstalling with yum did put me in the same situation as before.I tried to look at the httpd debugging guide, but that would be a too big learning step for me right now. so you were right, reinstalling was a quicker solution.

I confirm, yum does it…remove files and take care of file permissions.

But nethserver-wordpress doesn’t create the mysql db if it previously exists and the e-smith database is not removed by yum. Hence for any nethserver-package you must remove manually the mysql database and the esmith database if you want to start a clean install.

I am not arguing, yum probably does it right, but some other thing did go wrong in my case, even after the first yum removal. It makes sense that after reinstallation the url pointed still to the wrong url in the db, which had a typo, but even with that i couldn’t access the site either.
Anyway, it will stay a miracle what was wrong there, for now. I have a clone of that server and plan to investigate further for learning reason, once my skill allows it more effectively.
Thanks for your effort though, i appreatiate it a lot.
Edit: would it make sense to add the reinstall steps with the db removal to the wiki?

Any user experiences make sense to be written in the wiki :slight_smile:

Please go ahead

@stephdl

I am so new here i doubt i can write to the wiki. Would be like giving a smartphone to a one year old. :grinning:
EDIT:
Will the wordpress installed this way be included in the server backup? If not, can you tell me what has to be added here?

In fact you need to backup the folder /usr/share/wordpress/wp-content/ and the mysql database

For that you have several ways, even with plugins, but the easier would be to drop a file

[root@NS7DEVAll]# cat /etc/backup-data.d/wordpress.include
/usr/share/wordpress/wp-content

This folder will be included in the backup of NS, and its mysql database also…if nethserver-backup-data is installed

I tend to think that the admin is responsible of his backups, do you think that I should add it automatically to the rpm ?

@stephdl
Either including it to the RPM for lazy people like me, or adding the howto to the wiki both good enough.
If you want i can modify the wiki with my experience and pm it to you. If you like it, you can then update the wiki.

I have had a go, please check the wiki

hi,

I’ve the same problem have you found the reason for in the meanwhile!?

thx

martin

hi,

just for information - after system reboot the problem has gone

martin