GuestbookSign our guestbook ContactGet in touch with the authors ArchiveAll unixwerk articles since 2003
November 26, 2013

Prepare Apache and MariaDB for Typo3 on Slackware

This article describes how to prepare your Slackware 14.1 system for Typo3.

Contents

  1. Prepare MySQL/MariaDB
  2. Prepare Apache and PHP
  3. Install the Typo3 Package
  1. Logfiles
  2. References
 

1. Prepare MySQL/MariaDB

STEP 1: Edit /etc/my.cnf

Enter the directory where you want to put the database (e.g. /data/db).

[server]
datadir=/data/db
skip-networking 

In the above example we disable networking as well since the database is only locally used by the web server.

 

STEP 2: Initialize MySQL/MariaDB

# mysql_install_db --user=mysql
Installing MariaDB/MySQL system tables in '/data/db' ...
OK
Filling help tables...  
OK 

 

STEP 3: Start MySQL/MariaDB

The database directory /var/lib/mysql is hard-coded in /etc/rc.d/rc.mysqld. Change it to your database directory (e.g. /data/db) if needed. Then start mysqld:

# sh /etc/rc.d/rc.mysqld start

 

STEP 4: Create a database for use with Typo3

Let's say we call our database "typodb" and we set a very secret admin password "abc123":

# mysqladmin password abc123
# mysqladmin -u root -p create typodb
Enter password: 

 

STEP 5: Connect to the database and set user and password for access:

Let's say we call the user "typouser" with the same secret password:

# mysql -u root -p mysql
Enter password: 
MariaDB [mysql]> GRANT ALL ON tyopdb.* TO typouser@localhost IDENTIFIED BY 'abc123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> quit;
Bye

The database has to be reloaded:

# mysqladmin -u root -p reload

... and we can check that the new user exists and has a password set:

# mysql -u root -p mysql
Enter password: 
MariaDB [mysql]> select host, user, password from mysql.user;
+-----------+----------+-------------------------------------------+
| host      | user     | password                                  |
+-----------+----------+-------------------------------------------+
| localhost | root     | *A182C560D66CCD3BC28598CE9E3A53A6CB10FD5D |
| myhost    | root     |                                           |
| 127.0.0.1 | root     |                                           |
| ::1       | root     |                                           |
| localhost |          |                                           |
| myhost    |          |                                           |
| localhost | typouser | *598CEF3D28EC7F645D282089B72DC69E3A53A6CB |
+-----------+------+-----------------------------------------------+
7 rows in set (0.00 sec)

MariaDB [mysql]> quit;
Bye

Now we should be able to login to our database.

# mysql -u typouser -p typodb
Enter password: 
MariaDB [typodb]>

Anyway, there is nothing to do for us here... So we leave with quit;.  

STEP 6: Enable mysql at boot-time

As always with Slackware this has to be done by setting the executable bit on the start script:

# chmod +x /etc/rc.d/rc.mysqld
 

2. Prepare Apache and PHP

STEP 1: Enable PHP in /etc/httpd/httpd.conf:

Add 'index.php' to directory index:


<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

and enable the PHP module by uncommenting:


#Uncomment the following line to enable PHP:
#
Include /etc/httpd/mod_php.conf

You don't need to edit /etc/httpd/mod_php.conf since it has mod_php already enabled for all files ending with .php

 

STEP 2: Enable mod_rewrite in /etc/httpd/httpd.conf:

Uncomment the line starting with LoadModule rewrite_module:

LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so

In the main directive for DocumentRoot change the AllowOverride rule:

 DocumentRoot "/data/www/htdocs"
 <Directory "/data/www/htdocs">
    :
    :
    #AllowOverride None
    AllowOverride Indexes FileInfo
    :
    :
 </Directory>

If you don't change this the rewrite rules in the .htaccess files shipped with Typo3 would be ignored by apache.  

STEP 3: Enable mod_expires in /etc/httpd/httpd.conf

Uncomment the line starting with LoadModule expires_module:

LoadModule expires_module lib/httpd/modules/mod_expires.so

 

STEP 4: Adjust setting in /etc/httpd/php.ini

Check the maximum execution time and increase if necessary depending on your system's performance - a higher value doesn't really harm:

max_execution_time = 90

Check the timezone settings and set timezone to your local timezone, e.g.

date.timezone = "Europe/Berlin"

Check the memory limit and set it to at least 128M:

memory_limit = 128M

The maximum size of a file to upload is too low by default. Set it to at least 10 MB:

upload_max_filesize = 10M

 

STEP 5: PHP Extensions

According to the latest INSTALL.txt the below PHP extensions should be available:

With Slackware 14.1 all of these should be enabled. You can check with php -i, e.g. for json support:

# php -i | grep -i -w ^json
json
json support => enabled
json version => 1.2.1
 

STEP 6: Start the web server

This can be done by executing the start script in the /etc/rc.d directory:

# sh /etc/rc.d/rc.httpd start
 

STEP 7: Enable httpd at boot-time

As always with Slackware this has to be done by setting the executable bit on the start script:

# chmod +x /etc/rc.d/rc.httpd

 

3. Install the Typo3 Package

This is how to install the Typo3 package into the DocumentRoot directory

STEP 1: Download the introduction package:

Navigate to http://typo3.org/download/ and select the Introduction Package [tar.gz].  

STEP 2: Unpack the introduction package

As root go to your DocumentRoot (e.g. /data/www/htdocs):

# cd /data/www/htdocs
# tar xvzf /path/to/introductionpackage-6.1.5.tar.gz
# mv introductionpackage-6.1.5/* introductionpackage-6.1.5/.htaccess .
# rmdir introductionpackage-6.1.5
 

STEP 3: Adjust permissions

The default user running the web server is apache. Some directories need write permission for the web server.

# chown -R apache.apache fileadmin/ typo3conf/ typo3temp/ uploads/
# chmod -R g+rwX,o-w fileadmin/ typo3temp/ typo3conf/ uploads/
# chown root.apache /var/lib/php/         # should be already ok
# chmod 770 /var/lib/php/                 # should be already ok
 

STEP 4: Initial configuration with the 1-2-3 installer

Now everything is prepared and we can open a browser window and navigate to http://localhost/.

The Installer appears. Now just follow the steps on the screen. Remember your database, user, and password.

 


Appendix

 

A. Logfiles

 

B. References