In one of our previous posts, we explained how to install Joomla 3 on Ubuntu 14.04. Joomla is a Content Management System (CMS for short) – this is user-friendly software that allows you to build websites and manage the content on your websites easier than ever before.
In this tutorial, unlike the previous Joomla install guide, we wrote a script for you to help make the installation of Joomla 3.7 on a CentOS/Fedora VPS even faster and easier. This script will automatically do everything that should be done on your server, including the creation of a MySQL database while also creating an Apache virtual host for your Joomla website. All you need to do is to create a file on your server containing the script below, then simply execute the script and enter your details when prompted to.
(Note: You will need to have MySQL and Apache installed on your server in order for this script to work correctly.
You will also need to point your domain to your server’s IP address by editing your DNS server information. )
Create a file on your server with your favorite text editor and copy this script into your file:
#!/bin/bash # Install Joomla on a CentoOS/Fedora VPS # # Create MySQL database read -p "Enter your MySQL root password: " rootpass read -p "Database name: " dbname read -p "Database username: " dbuser read -p "Enter a password for user $dbuser: " userpass read -p "Enter your server's public IP address: " address mysql -uroot <<MYSQL_SCRIPT CREATE DATABASE $dbname; delete from mysql.user where user='$dbuser' and host = 'localhost'; flush privileges; CREATE USER [email protected]; GRANT ALL PRIVILEGES ON $dbname.* TO [email protected] IDENTIFIED BY '$userpass'; FLUSH PRIVILEGES; MYSQL_SCRIPT echo "New MySQL database has been successfully created" sleep 2 # Download, unpack and configure Joomla read -r -p "Enter your Joomla URL? [e.g. mydomain.com]: " joomlaurl mkdir -p /var/www/html/$joomlaurl && \ wget -P /var/www/html/$joomlaurl \ https://downloads.joomla.org/cms/joomla3/3-7-2/Joomla_3-7.2-Stable-Full_Package.zip && \ cd /var/www/html/$joomlaurl echo "Installing unzip package if necessary..." && yum -yq install unzip sleep 3 unzip Joomla*.zip && rm -f Joomla_*.zip && \ chown apache: -R /var/www/html/$joomlaurl killall httpd # Create the Apache virtual host echo " <VirtualHost $address:80> ServerName www.$joomlaurl DocumentRoot "/var/www/html/$joomlaurl" DirectoryIndex index.php Options FollowSymLinks ErrorLog logs/$joomlaurl-error_log CustomLog logs/$joomlaurl-access_log common </VirtualHost> " >> /etc/httpd/conf/httpd.conf service httpd restart echo -en "\aPlease go to http://www.$joomlaurl and finish the installation\n" #End of script
Make the script executable, then execute the script:
chmod +x <script name> && ./<script name>
(Replace <script name> with the name that you have given to your file)
After running the script, you will have successfully installed Joomla 3.7 on your CentOS or Fedora VPS! All that is left to do is to set up the remainder of Joomla at your web domain.
Of course, you don’t have to do any of this if you use one of our Joomla VPS hosting services, in which case you can simply ask our expert Linux admins to install Joomla for you. They are available 24/7 and will take care of your request immediately.
PS. If you liked this post, please share it with your friends through social networks by using the buttons below, or simply leave a reply below. Thanks.