Hosting Linux (cPanel) Bantuan

How to install Joomla Console on cPanel Shared Hosting

Joomla Console is a command-line utility for the Joomla web CMS/application. It provides advanced functionality for powerusers who wish to manage their Joomla site via SSH. These advanced functions include creating new sites in Joomla rapidly, installing extensions, creating symlinks to custom code, version control with git, and many more - all through command line. More information on how to use this utility is available at joomlatools.com, the developer of the CLI utility. This guide will not cover how directly to use the Joomla Console utility, but will cover how to properly install Joomla Console in GoDaddy shared hosting powered by cPanel

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
TIME REQUIRED 15-30+ min
RELATED PRODUCTS Linux-based VPS or dedicated servers

Obtain the Joomla Console Files

Log in to your cPanel hosting account via SSH. Make sure SSH is enabled for your IP before connecting.

Once logged in, make sure you are in the home directory of your hosting account. You can ensure this by using the command pwd to print the working directory. It should show you as being in /home/username, where username is your primary username for cPanel.

From your home directory, use the wget command to get the newest version of Joomla Console. We suggest getting this directly from the joomlatools.com GitHub, to ensure that it is always the most up-to-date version of Joomla Console.

wget https://github.com/joomlatools/joomla-console/archive/master.zip

You now have a zip of the most up-to-date version of Joomla Console - named master.zip

Installing Joomla Console files

Unzip the Joomla Console archive by using the following command

unzip -q master.zip

This will unzip the files to the ~/joomla-console-master directory. For the ease of use, lets rename this directory to be 'joomla-console,' by using the following command:

mv joomla-console-master/ joomla-console

You should now have a directory in your home directory named 'joomla-console.'

Just to make sure we are keeping our hosting account clean, lets remove the original master.zip file. If we need to update Joomla Console later, we can do so by pulling from the GitHub again:

rm master.zip

Before moving on, lets also update the permissions to the Joomla Console executable so that can be executed by the server. Do this by using the following command:

chmod u+x ./joomla-console/bin/joomla

Installing composer

PHP composer is a PHP dependency management suite that allows PHP to do the heavy lifting for you, ensuring that PHP knows which libraries to use when executing Joomla Console commands. This section will show how to get Composer, then properly use composer to complete the install of Joomla Console.

Navigate to the Joomla Console directory by using the cd command.

Use the curl command to grab the composer files, then pipe them to PHP to be executed. This is done by using the following command:

curl -sS https://getcomposer.org/installer | php

You should see an output regarding the settings of composer.

Run the command that composer provides to you to properly install Joomla Console.

php composer.phar install

You will see an output of different dependencies that are installed for Joomla Console. Composer should now complete the dependency installs for Joomla Console

For Joomla Console, unlike other CLI utilities, you need to run php composer.phar update instead of php composer.phar install. This is due to composer needing to correct the dependencies inside the Joomla console software first before installing.

Configuring bash to recognize Joomla Console

Now that we've installed Joomla console, we need to make some changes to two of our files that control how bash will behave with the new utility

Change back to your home directory with the following command:

cd ~

Now that we need to add the proper alias to our .bashrc file in our home directory. If you are intending to use a text editor such as Notepad++ or vim, then you may simply add this line to the .bashrc file.

alias joomla='~/joomla-console/bin/joomla'

If you've never edited your .bashrc file, or never installed any other command line utilities, its likely that you can add this to the .bashrc file by using this one-line command:

echo "alias joomla='~/joomla-console/bin/joomla'" >> .bashrc

So that's one file down. Next, we need to make a similar edit to our .bash_profile file. Again, if you're using a text editor, simply add this line to the bottom of the file named .bash_profile:

export PATH='$PATH:~/joomla-console/bin:/usr/local/bin'

And just like the previous command, if you're not often making edits to your .bash_profile file you can use this one-liner to automatically append it to the file. Most people can use this command, though if you're not sure its always safer to edit manually.

echo "export PATH='$PATH:~/joomla-console/bin:/usr/local/bin'" >> .bash_profile

Using the source command, update bash's settings so that it pulls the new settings from the new .bashrc and .bash_profile files:

source .bashrc
source .bash_profile

And we are done! To confirm that Joomla Console is working, run the command:

joomla help

You should see an joomla console output. Congratulations, you have successfully installed the Joomla Console.


Apakah Artikel Ini Berguna?
Terima Kasih Atas Umpan Balik Anda
Senang bisa membantu! Ada hal lain yang dapat kami lakukan untuk Anda?
Maaf tentang hal tersebut. Bagaimana kami bisa membantu lebih?