Categories
Business suitecrm Technology Tutorial Ubuntu

How to Back Up your SuiteCRM Stuff on Ubuntu Server

Been a big fan and user of SuiteCRM for years. Never really did learn how to properly back up from my own server so yeah. Time to do it!

Backing up your SuiteCRM MYSQL Database

This is not for saving the files (ie. the custom settings you have made to SuiteCRM over the years and all the PDF templates, workflows, etc). This is just a raw datadump of the database. Be sure also to back up the suitecrm app files as a separate step (to be documented)

  1. ssh into the server with the usual ssh username@123.123.123.123
  2. cd to a location where you would like to back things up. I’ll just do the home directory for mine:
    cd ~
  3. Create a directory into which your backup will go. I will do example in home directory with directory name ‘suitecrm_backups’:
    mkdir suitecrm_backups
  4. CD into this new directory:
    cd suitecrm_backups
  5. Perform this command inserting the appropriate data:
    mysqldump -u admin_user -p suitecrm_DB_name > suitecrm_backup_yymmdd.sql

If you happen to forget the name of your database, you can log into mysql with your user/pw and use this command to show all databases. Login mysql -u admin_user -p and then show the databases with show databases;

  1. After the quality dump, look inside directory to make sure it’s all there and looking good:
    ls -al | grep suitecrm_backups
  2. Great! Now you’ll have to go and get that file off your server and you can skip to the ‘Retrieving Your Backed-up Files’ section below to do that now if you’d like.

Special thanks to this blog

Backing up your SuiteCRM Files

Now that you have your mysql database is backed up, create a file on your server where the soon-to-be backed-up SuiteCRM-specific files will go. It must be writable by the SuiteCRM user so I put mine right in the SuiteCRM folder in var/www/html/suitecrm’, although not sure if that’s a good idea. I’m just not smart enough to know but it did work. I’m pretty sure this folder would not make it through an upgrade, though, so we’d have to back up just before the upgrade and then re-create it after, I’m guesssing.

  1. Navigate to a good place: cd / var/www/html/suitecrm
  2. Make the backup directory: mkdir suite_backups
  3. Give directory correct permissions:
    sudo chown -R www-data:www-data /var/www/html/suitecrm/suite_backups
    sudo chmod -R 755 /var/www/html/suitecrm/suite_backups
  4. In the Suitecrm user interface, go to ‘Admin / Backups’
  5. Enter the path to the directory you just made in step 2 in the ‘directory’ field. Mine looks like this with the ‘var’: /var/www/html/suitecrm/suite_backups
  6. Enter the name of the file you want to call the zip file (ie. suitecrm_backup_yymmdd.zip) NOTE it seems that the system does not append the .zip so you have to make sure to manually enter it in this field.
  7. Confirm your settings. If it’s good you will be able to press ‘Run Backups’ button otherwise you’ll be told what is wrong.
  8. Press “Run Backups”
  9. If everything worked well it will tell you it was done correctly and sitting in the folder.
  10. Check to make sure it’s there with ls -al
  11. All good? Go ahead and download it using the cool sftp tool in the “Retrieving Your Backed-up Files” section below.

Retrieving Your Backed-up Files

  1. Open new terminal window on your local machine if you are like me and already logged into your suite machine in the original window above.
  2. In your new terminal window, navigate to where you want the backup files to end up. If you do nothing, they will end up in your HOme directory, but this is the one slightly weird thing to me. You can’t really change this later so do it now for simplicity, or at least note all your stuff will end up in your home directory.
  3. Log into the server in nearly identical way as ssh: sftp user@123.123.123.123 and enter password when prompted
  4. Navigate to your file using your familiar cd and ls commands. So easy. In fact, just like ubuntu terminal navigation…
  5. When you track down your desired file, do a get filename.zip and wait. You should see some ‘fetching’ comments and then it will end. Check to make sure you have it.

Hope this all helps. Thanks to the team at SuiteCRM.

Categories
Technology Tutorial Ubuntu

How to Back Up SuiteCRM using Ubuntu

I discovered SuiteCRM by means of searching through my web host’s cpanel softaculous thing – that thing that allows one click installs of ‘apps’ for your server.  Over time, I became a heavy believer in and user of SuiteCRM.  Eventually, I installed an instance for my company on my shared host and the company started using it more and more. Finally, today, I realized that I better figure out how to back this bad boy up.  I thought it would be as simple as going to the SuiteCRM documentation, but I guess I’m not smart enough for that.  I also tried the SuiteCRM user guides which, for everything else, are very excellent.  However, couldn’t seem to figure it out there, either.  There is also this ‘backup feature’ in the Admin area which also I couldn’t figure out on my own or by searching.  I even posted this post in the forum and it seems as though I had asked a question that was too easy for anyone to answer.

I’m just a standard, shared host, cpanel user, not a database guy or even web host guy, although I’ve got a small server running at home.  How is it that I cannot figure out how to do a simple back up of SuiteCRM so that I can protect it as well as move it from host to host should I choose?   So, with all that background, I will now begin to find the answer and document it here for my future benefit and hopefully help a few others along the way.

What I have learned from reading most stuff online is that If I want to be sure something like SuiteCRM is backed up safely I have to do the following two things:

  • backup the SuiteCRM folder/directories/files
  • back up the mysql database

Sounds easy except that when I went into cpanel, there was no ‘download’ button to get all my directory stuff!  Although I’m shocked that there doesn’t seem to be a web-based download button, I also assume there must be a  security reason for that so I won’t kick up a storm. I now assume that I have to do it the old FTP client way.  So, I will now perform the following two steps in an attempt to download the directory parts of SuiteCRM:

  • create an FTP account from the home page area of cpanel so that I can login with FTP client and
  • download and install Filezilla on my computer

I went to the Ubuntu software centre and downloaded Filezilla successfully.

I entered in my credentials.  It turns out that I did not have to create a new FTP user since my main cpanel login credentials/passwords worked perfectly to get in.  However, if this is for someone else to login, obviously you’ll want to create a new FTP user/password for them and restrict them to the areas they are permitted to go.

Since my website wasn’t the ‘main’ website of my shared hosting, I had to go into the ‘public_html’ directory to find my SuiteCRM directory.  Found it!

I learned the hard way that I must *first* choose the local machine directory to where the files must be downloaded.  The first time I didn’t specify so it started running errors for five minutes while I sat there and drooled on my desk.  Once I figured it out, I cancelled, started again by stating the local directory (in fact, I created a new directory just in case and to help me remember where it was) and then right clicked on the ‘remote server’ folder (my SuiteCRM install folder) and clicked ‘download’ and now everything appears to be downloading successfully to my machine.

The next step will be the second step which is to download/backup the mysql database…  Of course, I’ve never done this so I am going to find this tutorial by Siteground which looks pretty solid.  Siteground (whoever they are) seem pretty cool, by the way and has killer SEO results with Duck Duck Go.  Let’s see if this tutorial works.  You will probably have lots of time to study this tutorial if your FTP download is as big as mine.  My SuiteCRM has nearly 10,000 files to download.  It appears also, that this tutorial will show how to restore this mysql database for the next part of this tutorial which I’ll probably have to write for myself…  In this tutorial, the only thing that seems ‘unknown’ to me is the ‘drop table’ option.  Good thing I didn’t choose this option, I believe, because this tutorial shows that ‘drop table’ means to delete tables.  I am quite certain that I will want to *keep* all the tables in this database so that I can import the database perfectly into the server to match the SuiteCRM stuff…. but I don’t know anything so we’ll see as we move forward 🙁

The above tutorial was good except that they claimed there was an ‘add drop table’ option in their screenshot example but it wasn’t there.  They also didn’t mention that you have to choose ‘custom’ instead of ‘quick’ in order to view those options.  And it turns out that the ‘add drop table’ option is just a recommended feature to add in while exporting which I chose to do.  Otherwise, click ‘go’ and it worked. I have an .sql file on my hard drive now.

I think I’ve now backed everything up, but now I have to try to move it onto another server to test it out.  Hopefully I will have a link to that tutorial soon but for now, stand by.