Installing MODx
From InstallationWiki
| Official Page |
| Project Documentation |
| Download |
|
Contents |
[edit] Setting up the development environment
This section of the tutorial will help you to install MODx and verify that it is working.
[edit] Prerequisites
The following is the list of software packages that have to be installed for MODx to work. If you have them installed and configured already, you can skip this section. Otherwise, you can read only the instructions that are specific to your operating system.
- PHP
- MySQL
- Apache
MODx is built using PHP, which stands for PHP hypertext processor. PHP is a server side language and we need a web server that can interpret PHP. We are using Apache for this, which is the most widely used web server. Apache is not really a prerequisite, any web server that can interpret PHP would do.
MODx uses MySQL as the database server.
For the sake of simplicity and consistency of settings and configurations, throughout the tutorial we will be using a package called XAMPP that bundles Apache, PHP, MySQL, and tools to get you easily started with a local development environment.
This section will show you how to set up the prerequisites for different OS.
Linux
XAMPP for Linux is available for download from http://www.apachefriends.org/en/xampp-linux.html#374.
Download the latest stable release available. You will get a file like xampp-linux-(version number).tar.gz.
1.To begin installation, open a shell prompt like konsole or gterm.
2.Change the current directory to the directory where you have downloaded XAMPP. If you have downloaded it to the desktop, type cd ~/Desktop.
3.To install XAMPP, you must have super-user rights. If you are not the super user, type "su" followed by the password at the prompt to get root user permissions. Some operating systems like Ubuntu do not have a super user. In such a case, you must prefix "sudo" before the commands mentioned here.
4.Now type tar xvfz xampp-linux-(version number).tar.gz -C /opt. If you have done everything properly so far, you will have installed XAMPP successfully.
5.To start the XAMPP server, type /opt/lampp/lampp start. If XAMPP has been started successfully, you will see a line like this: "LAMPP started".
| The Linux version of XAMPP was previously called LAMPP and so you may see LAMPP where you expected XAMPP. |
Windows
XAMPP for Windows is available for download at http://www.apachefriends.org/en/xampp-windows.html. Download the version that is packaged as a Windows Installer file, as it is easier to set up.
Run the setup file and choose the installation directory. After successful installation, you will see a small icon in the task bar that lists the enabled services. Make sure that Apache and MySQL are running. If they are not, click on the Start button next to the Apache and MySQL services. Your Windows firewall might ask if you want to block these services. If asked to do so, click on the Unblock button.
Note that we are using XAMPP here only to make things simpler for you to get started. You can use any web server that supports PHP, including IIS.
MAC
MAMP is the easiest way to get started in a MAC machine. It can be downloaded from http://www.mamp.info/en/mamp.html and installed like any other MAC application.
Verification
To verify that the installation is working, open the browser and type http://localhost. You will see a page similar to the following if everything is installed correctly.
[edit] Downloading MODx
MODx is available for download from http://MODxcms.com/downloads.html. MODx is distributed under the GNU General Public License which, on a lighter note, means that you can download it for free, install it on as many sites as you like, and even modify and redistribute it under a new name. For more information about the license, read http://MODxcms.com/license.html.
Like most open source projects, MODx has a stable release and a preview beta release. The stable release is what has been tested and made ready for production. For any production use, you must be using the stable version. The preview and beta release is to test out new features and possibly identify any bug in the process of using it. There is also a development snapshot that can be checked out (downloaded) from the SVN repository (http://MODxcms.com/svn.html) as the developers make changes.
For this tutorial, we will be using the stable version. The stable version at the time of writing was 0.9.6.1p2. Click on the link that allows you to download the stable version, and unzip it using any ZIP utility your operating system supports like WinZip, WinRAR, or TAR.
[edit] Installing MODx
Unzip the downloaded archive and place it in a folder named learningMODx within the root directory of your web server. This should be a directory named www or htdocs under your apache or XAMPP installation.
Possible Root Folders can be one of the following depending on the installation:
- /var/www/
- /opt/xampp/htdocs/
- c:\program files\xampp\htdocs
Now open http://localhost/learningMODx. If everything is fine so far, you should be seeing something like this:
[edit] Creating a database
MODx needs one database to store all the data. This database must be created, and the appropriate username and password must be given for a user who has privileges to read and write to the database.
MODx can create the database for you if the MySQL user that you specify in the setup page has permissions to create the specified database.
With the default installation of MODx, there is only one user with the name "root", and it is not a good idea to use this user for MODx or any similar platforms. This is because the database username and password are stored in plain text files and someone with access to just MODx files can bring down all the databases, sometimes even unintentionally.
- There are two methods to get the databases configured: You can create a user and grant that user privileges to create a database. In such a case, MODx can use that user and create the database for you.
- You can create the database and the user yourself.
In this example, we will create both the user and the database. phpMyAdmin comes along with XAMPP and is not related to MODx.
1.In a new browser page, open http://localhost/phpmyadmin.
2.Click on the Privileges link and then click on Add a new user.
3.In the new user page, for the purpose of this tutorial, create the username as learningMODx, give the password as m0dxdbus3r, and make sure you select the option Create database with same name and grant all privileges and click Go.
Here we have created a user called learningMODx and also a database with the same name, and we have granted all privileges on this database to that user.
If you are familiar with MySQL, you can also do the same with the following query using your MySQL client.
create database learningMODx;
grant usage on *.* to learniningMODx@localhost identified by
'learniningMODx';
grant all privileges on learningMODx.* to learningMODx@localhost ;
[edit] Starting the installation
The next step is to go to the page where you opened http://localhost/learningMODxy and click on Install now.
1.Select the language and click Next.
2.Click on Begin. You can always change anything that you have chosen in the previous page by clicking on the Back button.
3.Read through the agreement. MODx is released under a GNU license. Click on I agree to the terms set out in this license and click Next.
4.You will be asked about what you want the installer to do. For a site that is not yet installed, a new installation radio box will be the only option enabled. Click on the Next button.
'5.You will see a page like the following.
Enter this information into the following fields:
- Database name: The database that MODx must use. Fill it with the name of the new database that we have created: learningMODx.
- Database Login Name: Set the value of this field with the username we created: learningMODx.
- Database Password: Set the value of this field with the password that you gave during creation.
- Test Connection: After entering the preceding details, check that the database connectivity is working by clicking on Test connection. This will show a small label indicating if the connection succeeded or not.
- Default Admin User: MODx allows the user to manage the site from a frontend manager interface without having to look into the code or database. We will call this interface the manager interface. The Default Admin User can log in to the manager interface. Fill in the fields with the relevant details for this user and remember the username and password to be able to administer the site. Now proceed with the installation by clicking Next.
The next step is to check all the checkboxes in the next page and continue with the installation. These checkboxes tell MODx to install all the available resources and a sample site. It is not necessary in a production environment to check all the options, especially not the demo site. Here we are installing everything so that we can also learn by looking at the existing content once we are familiar with the basics. Each of the resources that you have selected will be explained in detail in the later tutorials.
[edit] Installation status and diagnostics
The next page makes a check to ensure that everything is working correctly. The only things that can go wrong are permissions on certain folders that have to be writable. In such a case, you will see messages in red describing which folders have to be writable but are not. The folders that require write permission during installation are assets/cache, assests/images, and assests/export. In Windows systems, this can be changed by right-clicking on the respective folders and choosing permissions. In Linux systems, use this command to change permissions:
$chmod -R 0666 (foldername)
You might also be required to create a file named config.inc.php in the
manager/includes/ folder with writable permissions. This file gets written automatically most of the time, but in some server environments that use IIS, it will not be possible to do so. If the web server has write permissions for the folder manager/includes/, then MODx will create config.inc.php automatically. However, this is not a good security practice.
You will then see an Installation Successul page with an option to delete the install folder. It is a good security practice to always delete that folder after installation. You don't want someone trying to reinstall your site, though he/she may not get very far without knowing your database access details.
After installation with the demo site, visit http://localhost/learningMODx and you will see a page like the following:
Also make sure that you are able to log in with the default admin user that you created. Open http://localhost/learningMODx/manager and type in your default admin username and password. After a successful login, you will see a page similar to the following:
If you have reached this point so far and can see the last page, it means that you have successfully installed MODx with the demo site and are all set to start learning and developing along with the instructions in the tutorial.
[edit] Additional References
For instructions on Theming MODx, click here
[edit] Source
The source of this content is Chapter 2: Installing Scalix of MODx Web Development by Antano Solar John (Packt Publishing, 2009).
