Solved: DNF broken after hostname change Fedora 26

So I created a new VM w/ Fedora 26… did dnf installs for nano ect, then changed host name with hostnamectl command, rebooted… and thats when dnf and yum wouldn’t work. Instead I would get the error

Failed to synchronize chache for repo ‘updates’

I googled around and fiddled with a few settings here and there thinking the hostname change f’d something up (which it may have), but the host name change replicated everything was where it was supposed to be…  the issue ended up being a DNS issue. I saw this when I edited /etc/resolve.conf and there was a random internal IP in there for a name server… so i deleted it and added google’s DNS server with the following lines.

  • nameserver 8.8.8.8
  • nameserver 8.8.4.4
  • #Then restart the network
  • Systemctl restart network

This fixed my issue… not sure what generated the weird DNS ip?

 

Easiest way to move WordPress to a new linux server

So I got a new box, installed fedora 25, configured everything I wanted… but was having a pain in the ass time migrating my WordPress sites to the new one. ~Insert moving sucks joke.

 

I’m no linux expert by any stretch, but I most of the issues was with the sql databases, as I was using phpmyadmin but error’ing out due to the size of the db’s and the gui just not  doing what it was supposed to. This was the easiest way I was able to do it was in command line following these steps

  1. On the old server your moving from… export the sql database for the WordPress site your moving and also download the wp-content directory. Put these in a directory on your new server… I stuck them in /var/www/tmp/oldwordpress.sql + /var/www/tmp/wp-content_OLD
  2. On the new server Setup a new black clean WordPress install directory and attach it to a clean db. We will eventually move / delete these but I setup a clean new WordPress site to eliminate any unknown issues and know that WordPress is running correctly when installed fresh.
  3.  Ok… so now the files we need are on the new server and its just a matter of importing and placing them where they need to go. Lets create a new sql database doing the following… assuming you have an sql root password already setup… if not you can google how to set that up on most “installing WordPress” tutorials. Bold text such as mywpsite should be changed to what you want it to be named…
sudo mysqladmin create mywpsitedb -u root -p
sudo mysql -D mysql -u root -p

MariaDB [mysql]> GRANT ALL PRIVILEGES ON MYWORDPRESSDB.* TO 'SQL_USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD';

MariaDB [mysql]> FLUSH PRIVILEGES;

MariaDB [mysql]> QUIT;

Ok… so now we’ve created a DB and an SQL user name and password… lets import our old sql tables by navigating to that file directory and manually importing them… remember to change bold text to your actually file names and credentials

cd /var/www/tmp
mysql -uSQL_USERNAME -pPASSWORD DATABASE < oldwordpress.sql

all your old tables should be associated with your new database now. Next step is to import all the content to the new WordPress install you have.

yes | cp -R /var/www/tmp/wp-content_OLD/* /var/www/newwordpressdir/wp-content

now edit the wp-config and change the values to point to the new database with the credentials you setup

nano /var/www/newwordpressdir/wp-config.php
// ** MySQL settings - You can get this info from your web host ** //

/** The name of the database for WordPress */

define('DB_NAME', 'MYWORDPRESSDB');

/** MySQL database username */

define('DB_USER', 'SQL_USERNAME');

/** MySQL database password */

define('DB_PASSWORD', 'PASSWORD');

last thing is to make sure you change ownership of the wp-content directory to apache if its not already.

chown apache:apache -R /var/www/newwordpressdir/wp-content

hopefully that works now, it did for me… you should be able to login and see all your plugins, themes, posts, etc working as it was on your old server.