This article will guide you through the process of setting up a Linux server capable of running AXS2LMS with default settings, suitable for a simple application.
You will need a CentOS 7 server with SSH access (get the image). Then, follow these steps:
- Install and configure MariaDB
- Install and configure Apache Web Server
- Install and Configure PHP – PHP-FPM
- Configure PHP-FPM
- Install Memcached
- Configure cron job for notifications
Step A: Install and Configure MariaDB Server #
1. Create repo for MariaDB:
Log in to your server and access the directory /etc/yum.repos.d
[root]# cd /etc/yum.repos.d
2. Create the file MariaDB-Server.repo and add the below in it:
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.4/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
3. Run yum update to load the new repository for MariaDB Server and install the MariaDB Server:
[root]# yum update [root]# yum -y install mariadb-server (accept all required packages if asked)
4. Use SSH to sign in to your server, using the root account, and run yum upgrade to bring the system up to date with the latest patches.
[root]# yum -y upgrade
5. Enable the query cache: edit the file /etc/my.cnf and add the following lines inside the [mysqld] section:
query_cache_type = 1 query_cache_limit = 1M query_cache_size = 64M
6. Start MariaDB:
[root]# /bin/systemctl start mariadb.service
7. Run mysql_secure_installation to set up and secure MariaDB:
[root]# mysql_secure_installation
8. Make sure MariaDB starts automatically:
[root]# systemctl enable mariadb.service
9. Connect to MariaDB and create new user and database for AXS2LMS:
[root]# mysql MariaDB> create database AXS2LMS; MariaDB> grant all privileges on AXS2LMS.* to 'AXS2LMS'@'localhost' identified by '<dbpass>'; MariaDB> flush privileges; MariaDB> exit;
<dbpass>
is your preferred password.Testing step: to test that the new user has access to the AXS2LMS database, run the command:
[root]# mysql -uefront -p<dbpass> AXS2LMS
If the above command is successful, you should log into the MariaDB Command Line interface
MariaDB>
Step B: Install and Configure Apache Web Server #
1. Install EPEL Repository for CentOS:
[root]# yum -y install epel-release
2. Install Apache Web Server:
[root]# yum -y install httpd
3. Make sure Apache starts automatically:
[root]# systemctl enable httpd.service
4. Edit the file /etc/httpd/conf/httpd.conf
and add the below line at the bottom of the file:
IncludeOptional sites.d/*.conf
5. In the same file, change the ServerName option to match the server’s domain name or IP address
6. Create a configuration file for the Virtual Host:
[root]# mkdir /etc/httpd/sites.d [root]# vi /etc/httpd/sites.d/AXS2LMS.conf
7. Add the following lines inside the newly created file axs2lms.conf:
<VirtualHost 127.0.0.1:80> ServerName localhost TimeOut 300 DocumentRoot /var/www/axs2lms/www/ ErrorLog /var/log/httpd/axs2lms-error.log CustomLog /var/log/httpd/axs2lms-access.log combined LogLevel warn <FilesMatch "\.php$"> SetHandler "proxy:fcgi://127.0.0.1:9000" </FilesMatch> <Proxy "fcgi://127.0.0.1:9000/"> </Proxy> <Directory /var/www/axs2lms/www/> AllowOverride All Order allow,deny allow from all Require all granted </Directory> </VirtualHost>
8. Upload the efront zip file (for example, eFront-5.2.16.zip) to the server and extract to the proper location:
[root]# mkdir /var/www/axs2lms [root]# cd /var/www/axs2lms [root]# mv ~/axs2lms-5.2.16.zip . [root]# unzip axs2lms-5.2.16..zip [root]# rm axs2lms-5.2.16..zip [root]# chown -R apache:apache
Note: If you have enabled selinux, then you have to permit Apache to write to the filesystem, by executing the following command:
[root]# chcon -t httpd_sys_rw_content_t /var/www/axs2lms -R
Note: The last command enables the user running apache to change any of the platform’s files. This simplifies things but is potentially unsafe. In production configurations, it is recommended to give write access only to the folders temp/
, backups/
, www/content/
and, for the duration of the installation, to libraries/
9. Restart Apache:
[root]# systemctl start httpd.service
Step C: Install and Configure PHP – PHP-FPM #
1. Create the repository for PHP version 7. To do so, go to the directory /etc/yum.repos.d:
[root]# cd /etc/yum.repos.d
2. Create the file webtatic.repo and copy the below in it:
[webtatic] baseurl = https://repo.webtatic.com/yum/el7/$basearch/ enabled = 1 gpgkey = https://mirror.webtatic.com/yum/RPM-GPG-KEY-webtatic-el7 mirrorlist = https://mirror.webtatic.com/yum/el7/$basearch/mirrorlist name = EPEL YUM repo
3. Update the repository manager:
[root]# yum update
4. Install PHP and required packages:
[root]# yum -y install php72w mod_php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-devel.x86_64 php72w-embedded.x86_64 php72w-fpm.x86_64 php72w-gd.x86_64 php72w-ldap.x86_64 php72w-mbstring.x86_64 php72w-mysqlnd.x86_64 php72w-opcache.x86_64 php72w-pdo.x86_64 php72w-pear.noarch php72w-pecl-apcu.x86_64 php72w-process.x86_64 php72w-tidy.x86_64 php72w-xml.x86_64
5. Set proper PHP limits: Edit the file /etc/php.ini and change max_execution_time, memory_limit and upload_max_filesize:
upload_max_filesize = 100M post_max_size = 100M memory_limit=512M
6. (optional step) Install OAuth:
[root]# yum install gcc [root]# pecl install oauth-1.2.3
Then, edit the file /etc/php.ini and add the line extension=oauth.so (You can also add this at the bottom of the file or among the other extensions existing in this file).
7. Make sure PHP-FPM starts automatically:
[root]# systemctl enable php-fpm.service
Step D: Configure PHP-FPM #
1. Go to directory /etc/php-fpm.d/ and copy existing www.conf to www.conf.original
[root]# cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.original
2. Create a new www.conf and set the below values:
[root]# vi /etc/php-fpm.d/www.conf listen = 127.0.0.1:9000 listen.allowed_clients = 127.0.0.1 listen.owner = nobody listen.group = nobody user = apache group = apache pm = dynamic pm.max_children = 50 pm.start_servers = 10 pm.min_spare_servers = 10 pm.max_spare_servers = 15 pm.max_requests = 200 pm.status_path = /php-fpm-status ping.path = /php-fpm-ping ping.response = pong slowlog = /var/log/php-fpm/www-slow.log security.limit_extensions = php_admin_value[error_log] = /var/log/php-fpm/www-error.log php_admin_flag[log_errors] = on php_value[session.save_handler] = files
3. Restart HTTPD and PHP-FPM Services to load the new configuration file.
[root]# systemctl restart httpd.service [root]# systemctl restart php-fpm.service
Step Ε: Install Memcached #
1. Install Memcached
[root]# yum -y memcached.x86_64 libmemcached.x86_64 libmemcached-devel.x86_64
2. Ensure that the file: /etc/sysconfig/memcached has the below values:
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS=""
3. Make sure Memcached starts automatically:
systemctl enable memcached.service
4. Start Memcached:
[root]# systemctl start memcached.service
Step F: Configure cron job for notifications #
Add the following lines in your cron job file so that eFront can send email notifications to your users. Edit the cron job file:
[root]# crontab -e
Update the following lines, replacing <hostname> with the actual domain name of your installation, for example https://example.axs2lms.com.
MAILTO="" */3 * * * * /usr/bin/php /var/www/efront/www/cron.php https://example.axs2lms.com
If you visit the server’s URL in the browser, for example,
https://example.axs2lms.com, you should see the installation wizard’s first page. Follow the on-screen instructions to set up AXS2LMS and you’re done.