-
This section is not aplicable if we have our own server.
For example, swad.ugr.es is hosted
in a server at the University of Granada.
An example of the server hiring process
used to install SWAD is described here.
Specifically, we focus in the case of the OpenSWAD server.
First, note that there are various types of
web hosting services,
the most common:
- Virtual hosting:
hardware resources are shared and the benefits are not very large,
it is cheap and ideal for single pages or with few visits..
- Virtual private server:
hardware resources are shared, but the customer sees a complete machine
where he/she can install the desired software.
- Dedicated hosting server:
a full real machine exists and the customer has all its resources.
For OpenSWAD we choose the third option, hosting in a dedicated server,
thinking about the medium-term needs.
There are a lot of providers of this type of hosting, and we opted for the company
Hetzner Online AG, that offers good service at a competitive price.
On March 2012 we choosed a
Dedicated server EX4
for its good price / performance ratio.
In this server we have root user and we must configure everything on our own,
as opposed to "managed server", much more expensive because is managed by the supplier.
The monthly cost of this server is €49 (19% VAT included)
and it also has a starting cost of setup of €149 (19% VAT included).
Application is made online through web forms and the payment is conducted through credit card.
In response they email the assigned IP and the root password to access the server,
that we should change.
Chosen server features included:
- Intel® Core™ i7-2600 Quadcore,
Hyper-Threading Technology
- RAM: 16 GiB DDR3
- Hard disks: 2 HD of 3 TB SATA,
6 Gbit/s, 7200 rpm (Software-RAID 1)
- NIC:
1 Gbit/s network card connected at 100 Mbit/s
- Backup space: 100 GB
- Trafic: connection is restricted to 10 Mbit/s if more than
10 TB/month are output.
On the software side, in the same form used to request the server,
we choosed, amongst various pre-installed operating systems,
the distribution of GNU / Linux CentOS 5.7.
On May 2014 we have upgraded the server to a
Dedicated server EX40,
which includes the following features by €49/month (19% VAT included) and a setup fee of €49 (19% VAT included):
- Intel® Core™ i7-4770
Quadcore Haswell incl. Hyper-Threading Technology
- RAM 32 GiB DDR3 RAM
- Hard Drive 2 x 2 TB SATA 6 Gb/s 7200 rpm. HDD (Software-RAID 1) Class Enterprise
- Connection 1 Gbit/s-Port
- Guaranteed Bandwidth 200 Mbit/s
- Backup Space 100 GB
- Inclusive Traffic 20 TB, connection is restricted to 10 Mbit/s if more than
20 TB/month are output.
In this new server we have choosed the distribution of GNU / Linux CentOS 6.5.
In the rest of this installation guide we give instructions for CentOS 6.5 and Ubuntu 14.04 LTS,
assuming that the user is root for some commands in CentOS 6.5 and a sudoer user in Ubuntu 14.04 LTS.
-
This section is not aplicable if we have a domain or subdomain asociated to the server.
In the case of OpenSWAD, we decided adquire the domain through
the same company that provided the hosting:
Hetzner Online AG.
We only needed openswad.org,
but we decided adquire openswad.com and
openswad.net also.
Each of these three domains has a yearly cost of €7,90 (19% VAT included)
if we make a initial payment of €29 (19% VAT included).
In our case we were exempt from this initial payment having previously engaged
the dedicated hosting service.
In order to obtain a user and a password required in the domain registration,
Hetzner requires the sending of a FAX with the bank details
for the direct debit from the receipts.
After sending the FAX, they immediately emailed the credentials to access,
and through web forms we proceeded to register the three domains.
-
In our case, once changed the root password with passwd
,
we found that the distribution CentOS 6.5 was really minimal.
In case of minimal distribution, it is necessary to install several packages.
-
Install the C compiler (necessary to compile SWAD):
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install gcc
|
|
-
Install the C++ compiler if not installed
(necessary to compile gSOAP
and the programs used for processing users' photographs):
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install gcc-c++
|
sudo apt-get install build-essential
|
-
Install the programs
zip
and unzip
if not installed:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install zip unzip
|
|
-
Install
wget
, gmake
, automake
and make
if our distribution is so minimal that they are not already installed:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install wget
yum -y install gmake
yum -y install automake
yum -y install make
|
|
-
It may be necessary to update packages and reboot after the update:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y update
reboot
|
sudo apt-get update
sudo reboot
|
Some of the programs used in SWAD (for example the program
to process users' photographs fotomaton
)
need Git,
libjpeg,
and OpenCV.
-
To install Git, we can use:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install git
|
sudo apt-get install git
|
If this method does not work, because git
is not in the repositories,
we can try the following:
yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel
wget http://git-core.googlecode.com/files/git-1.7.9.3.tar.gz
(or later version)
tar -xzvf ./git-1.7.9.3.tar.gz
(or later version)
cd ./git-1.7.9.3
(or later version)
./configure
make
make install
-
To install libjpeg:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install libjpeg-devel
|
sudo apt-get install libjpeg-dev
|
-
To install OpenCV,
may be that we need having installed previously version 2.6 or later of
CMake:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install cmake
|
sudo apt-get install cmake
|
or manually:
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
(or later version)
tar xvzf cmake-2.8.12.2.tar.gz
(or later version)
mkdir cmake-build
cd cmake-build
../cmake-2.8.12.2/bootstrap
(or later version)
gmake
gmake install
-
For the configuration of OpenCV
it is also necessary to have
pkg-config
installed:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install pkgconfig
|
sudo apt-get install pkg-config
|
-
To install OpenCV,
download the code from http://opencv.org/downloads.html.
We recommend to follow the steps of the installation guide, available in:
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html.
As an example, we followed these steps:
CentOS 6.5 |
Ubuntu 14.04 |
cd ~
wget sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip (or later)
unzip opencv-2.4.9.zip (or later)
cd opencv-2.4.9 (or later)
mkdir release
cd release
cmake ..
make
make install
cd ~
|
cd ~
git clone https://github.com/Itseez/opencv.git
cd opencv
mkdir release
cd release
cmake ..
make
sudo make install
cd ~
|
SWAD needs pandoc
1.10 or later
and iconv
to convert from Markdown format to HTML format.
SWAD needs convert
(part of ImageMagick)
to convert the size and format of the images uploaded by users.
-
To install
ImageMagick
:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install ImageMagick
|
sudo apt-get install ImageMagick
|
-
If Apache is not installed, we can install it with:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install httpd
yum -y install mod_ssl openssl
|
sudo apt-get install apache2 apache2-utils
Activate the cgi module and the rewrite module:
sudo a2enmod cgi
sudo a2enmod rewrite
sudo service apache2 restart
Activate the secure server:
sudo a2enmod ssl
sudo service apache2 restart
sudo a2ensite default-ssl
sudo service apache2 reload
(While installing swad in a Raspberry Pi 2 with Ubuntu Mate 16.04,
this failed because the files:
/etc/ssl/certs/ssl-cert-snakeoil.pem
/etc/ssl/private/ssl-cert-snakeoil.key
did not exist.
Following the instructions in
http://askubuntu.com/questions/49196/how-do-i-create-a-self-signed-ssl-certificate
we created them by writing:
sudo make-ssl-cert generate-default-snakeoil --force-overwrite )
|
Once Apache is installed, we need to configure it.
The configuration is in the directories:
CentOS 6.5 |
Ubuntu 14.04 |
/etc/httpd/conf/
/etc/httpd/conf.d/
|
/etc/apache2/
/etc/apache2/conf.d
|
Go to configuration directory and make a backup of the original configuration file:
CentOS 6.5 |
Ubuntu 14.04 |
cd /etc/httpd/conf/
cp -a httpd.conf httpd.conf.original
|
cd /etc/apache2/
sudo cp -a apache2.conf apache2.conf.original
|
CentOS 6.5 |
Ubuntu 14.04 |
Edit the file httpd.conf , make the following changes, and save it:
-
In
Section 1: Global Environment , search the line:
Timeout 60 / Timeout 120 (or another value)
and replace it by:
Timeout 300
This allows running SWAD CGI during 5 minutes,
because some slow options require a lot of time.
If response time expires before the end of the CGI,
an error 500 will be generated.
-
In
Section 2: 'Main' server configuration , search the line:
ServerAdmin root@localhost
and replace the email address by that of the admin.
-
In
Section 2: 'Main' server configuration , search the commented line:
#ServerName www.example.com:80
and add the line:
ServerName our-URL
after it. our-URL is the server address, for example openswad.org .
-
In the options for the root directory for web pages,
usually
/var/www/html ,
search the line:
Options Indexes FollowSymLinks
and replace it by:
Options FollowSymLinks
Remove Indexes to not list files in directories.
-
To cache contents, before the options for the root directory for web pages,
usually
/var/www/html ,
insert the lines:
#
# Cache
#
ExpiresActive On
ExpiresDefault "access plus 1 day"
Also, inside the root directory for web pages,
usually /var/www/html ,
insert the lines:
#
# Cache
#
ExpiresByType text/html "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 1 day"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
-
In the section
DirectoryIndex search the line:
DirectoryIndex index.html index.html.var
and replace it by:
DirectoryIndex index.html index.htm
|
Edit the file apache2.conf :
sudo gedit apache2.conf
Make the following changes, and save it:
-
In
Global configuration check that the following line is present:
Timeout 300
This allows running SWAD CGI during 5 minutes,
because some slow options require a lot of time.
If response time expires before the end of the CGI,
an error 500 will be generated.
-
Inside the options for the directory
/var/www/ ,
search the line:
Options Indexes FollowSymLinks
and replace it by:
Options FollowSymLinks
Remove Indexes to not list files in directories.
|
Go to configuration directory and make a backup of the original configuration files:
CentOS 6.5 |
Ubuntu 14.04 |
cd /etc/httpd/conf.d/
cp -a ssl.conf ssl.conf.original
|
cd /etc/apache2/sites-available/
sudo cp -a 000-default.conf 000-default.conf.original
sudo cp -a default-ssl.conf default-ssl.conf.original
|
CentOS 6.5 |
Ubuntu 14.04 |
Edit the file ssl.conf , make the following changes, and save it:
-
At the end of the file, before
</VirtualHost> ,
add the following lines:
#
# Rewrite URIs to be user friendly
#
RewriteEngine On
RewriteRule /institution/([^/]+)/?$ /?ins=$1
RewriteRule /centre/([^/]+)/?$ /?ctr=$1
RewriteRule /degree/([^/]+)/?$ /?deg=$1
RewriteRule /course/([^/]+)/?$ /?crs=$1
RewriteRule /user/([^/]+)/?$ /?usr=$1
#
# Rewrite URIs depending on browser language
#
RewriteCond %{HTTP:Accept-Language} ^(ca)[-,;]? [NC]
RewriteRule "^/$" "/ca" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(de)[-,;]? [NC]
RewriteRule "^/$" "/de" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(en)[-,;]? [NC]
RewriteRule "^/$" "/en" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(es)[-,;]? [NC]
RewriteRule "^/$" "/es" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(fr)[-,;]? [NC]
RewriteRule "^/$" "/fr" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(gn)[-,;]? [NC]
RewriteRule "^/$" "/gn" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(it)[-,;]? [NC]
RewriteRule "^/$" "/it" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(pl)[-,;]? [NC]
RewriteRule "^/$" "/pl" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(pt)[-,;]? [NC]
RewriteRule "^/$" "/pt" [L,R=301]
# Rewriting for other languages
RewriteCond %{HTTP:Accept-Language} !^(ca|de|en|es|fr|gn|it|pl|pt) [NC]
RewriteRule "^/$" "/en" [L,R=301]
#
# Aliases
#
ScriptAlias /ca "/var/www/cgi-bin/swad/swad_ca"
ScriptAlias /de "/var/www/cgi-bin/swad/swad_de"
ScriptAlias /en "/var/www/cgi-bin/swad/swad_en"
ScriptAlias /es "/var/www/cgi-bin/swad/swad_es"
ScriptAlias /fr "/var/www/cgi-bin/swad/swad_fr"
ScriptAlias /gn "/var/www/cgi-bin/swad/swad_gn"
ScriptAlias /it "/var/www/cgi-bin/swad/swad_it"
ScriptAlias /pl "/var/www/cgi-bin/swad/swad_pl"
ScriptAlias /pt "/var/www/cgi-bin/swad/swad_pt"
In the previous lines, /var/www/cgi-bin/swad/ is the path to the SWAD executable programs,
that could be in another location.
|
Edit the file 000-default.conf :
sudo gedit 000-default.conf
Make the following changes, and save it:
-
Find the line:
ServerAdmin webmaster@localhost
and replace the email address by that of the admin.
Edit the file default-ssl.conf :
sudo gedit default-ssl.conf
Make the following changes, and save it:
-
Find the line:
ServerAdmin webmaster@localhost
and replace the email address by that of the admin.
-
At the end of the file, before
</VirtualHost> ,
add the following lines:
#
# Rewrite URIs to be user friendly
#
RewriteEngine On
RewriteRule /institution/([^/]+)/?$ /?ins=$1
RewriteRule /centre/([^/]+)/?$ /?ctr=$1
RewriteRule /degree/([^/]+)/?$ /?deg=$1
RewriteRule /course/([^/]+)/?$ /?crs=$1
RewriteRule /user/([^/]+)/?$ /?usr=$1
#
# Rewrite URIs depending on browser language
#
RewriteCond %{HTTP:Accept-Language} ^(ca)[-,;]? [NC]
RewriteRule "^/$" "/ca" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(de)[-,;]? [NC]
RewriteRule "^/$" "/de" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(en)[-,;]? [NC]
RewriteRule "^/$" "/en" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(es)[-,;]? [NC]
RewriteRule "^/$" "/es" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(fr)[-,;]? [NC]
RewriteRule "^/$" "/fr" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(gn)[-,;]? [NC]
RewriteRule "^/$" "/gn" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(it)[-,;]? [NC]
RewriteRule "^/$" "/it" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(pl)[-,;]? [NC]
RewriteRule "^/$" "/pl" [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^(pt)[-,;]? [NC]
RewriteRule "^/$" "/pt" [L,R=301]
# Rewriting for other languages
RewriteCond %{HTTP:Accept-Language} !^(ca|de|en|es|fr|gn|it|pl|pt) [NC]
RewriteRule "^/$" "/en" [L,R=301]
#
# Aliases
#
ScriptAlias /ca "/var/www/cgi-bin/swad/swad_ca"
ScriptAlias /de "/var/www/cgi-bin/swad/swad_de"
ScriptAlias /en "/var/www/cgi-bin/swad/swad_en"
ScriptAlias /es "/var/www/cgi-bin/swad/swad_es"
ScriptAlias /fr "/var/www/cgi-bin/swad/swad_fr"
ScriptAlias /gn "/var/www/cgi-bin/swad/swad_gn"
ScriptAlias /it "/var/www/cgi-bin/swad/swad_it"
ScriptAlias /pl "/var/www/cgi-bin/swad/swad_pl"
ScriptAlias /pt "/var/www/cgi-bin/swad/swad_pt"
In the previous lines, /usr/lib/cgi-bin/swad/ is the path to the SWAD executable programs,
that could be in another location.
|
To allow the META tags in HTML content to override a charset choice, comment out this directive:
AddDefaultCharset UTF-8
by adding #:
#AddDefaultCharset UTF-8
Optionally, if we want to redirect from http://... to https://...
we should add some lines to configuration files:
CentOS 6.5 |
Ubuntu 14.04 |
Edit the file /etc/httpd/conf/httpd.conf ,
add the following lines at the end of the
Section 3: Virtual Hosts section:
<VirtualHost _default_:*>
Redirect permanent / https://openswad.org/
</VirtualHost>
(replace https://openswad.org/ by your https address),
and save it.
|
Edit the file /etc/apache2/sites-available/000-default.conf ,
add the following line into the
<VirtualHost *:80> section:
Redirect permanent / https://openswad.org/
(replace https://openswad.org/ by your https address),
and save it.
|
Restart the Apache web server with the changes just made:
CentOS 6.5 |
Ubuntu 14.04 |
service httpd restart
|
sudo service apache2 restart
|
-
Install the database manager MySQL, if not installed:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install mysql mysql-server
|
sudo apt-get install mysql-server
|
Install the development system for MySQL (necessary to compile SWAD):
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install mysql-devel
|
sudo apt-get install libmysqlclient-dev
|
We asume that MySQL is already installed. Now we must configure it.
Go to configuration directory and make a backup of the original file my.cnf
:
CentOS 6.5 |
Ubuntu 14.04 |
cd /etc/
cp -a my.cnf my.cnf.original
|
cd /etc/mysql/
sudo cp -a my.cnf my.cnf.original
|
Edit inside the file my.cnf
all the optimizations
that we consider neccesary for MySQL,
in function of the configuration of our server.
Probably we should increase query_cache_size
and key_buffer
/ key_buffer_size
.
Start MySQL server with the changes just made:
CentOS 6.5 |
Ubuntu 14.04 |
service mysqld restart
|
sudo service mysql restart
|
Set a password for the MySQL root user:
CentOS 6.5 |
Ubuntu 14.04 |
To do so, start the server, then issue the following command:
/usr/bin/mysqladmin -u root password 'new-password'
Alternatively we can run:
/usr/bin/mysql_secure_installation
which will also give us the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
|
|
Alternativelly, we can install the database manager MariaDB.
-
The source code of SWAD core is in GitHub:
https://github.com/acanas/swad-core
We can work in the home directory of a user: /home/<user_directory>
Create the directory /home/<user_directory>/swad
:
mkdir /home/<user_directory>/swad
and go to that directory:
cd /home/<user_directory>/swad
Download the last version of SWAD:
git clone https://github.com/acanas/swad-core
A directory swad-core
should have been created
inside /home/<user_directory>/swad
.
We already have the source code and other directories of SWAD core
in the directory /home/<user_directory>/swad/swad-core
-
Use mysql
command to connect to server with MySQL user root
:
mysql -u root -p mysql
If we have not set a password for the MySQL user root
in the installation process,
we must do it now:
mysql> SET PASSWORD FOR 'root'@'localhost'=PASSWORD('mypass');
(instead of mypass
we should a personal password)
and enter again in mysql
command with the MySQL root user:
mysql> quit
mysql -u root -p mysql
Create a new database called swad
:
mysql> CREATE DATABASE IF NOT EXISTS swad DEFAULT CHARACTER SET=latin1 DEFAULT COLLATE latin1_spanish_ci;
(by now, SWAD does not use UTF-8)
Create a new MySQL user called swad
with all the permissions
over the swad
database just created:
mysql> CREATE USER 'swad'@'localhost' IDENTIFIED BY 'some_pass';
(instead of some_pass
we should use our own password)
mysql> GRANT ALL PRIVILEGES ON swad.* TO 'swad'@'localhost' WITH GRANT OPTION;
mysql> SHOW GRANTS FOR 'swad'@'localhost';
mysql> quit
Inside the directory /home/<user_directory>/swad/swad-core/sql
it should exist a script file swad.sql
.
At the script start, a new database is created
and the type of character comparison (collation) by default is stored.
Comparisons when searching users or courses depend on the default collation.
We can change by another if we want,
preferably case insensitive (ending in _ci
).
Move to that directory and create the database tables swad
using the file swad.sql
:
cd /home/<user_directory>/swad/swad-core/sql
mysql -u swad -p < swad.sql
Check that swad
database tables are created:
mysql -u swad -p swad
mysql> SHOW TABLES;
mysql> quit
Inside the directory /home/<user_directory>/swad/swad-core/sql
it should also exist other SQL files:
actions.sql
countries.sql
institutions.sql
centres.sql
(optional)
deg_types.sql
(optional)
degrees.sql
(optional)
departments.sql
(optional)
mail_domains.sql
(optional)
places.sql
(optional)
that were created respectively from http://swad.ugr.es/
with the commands:
mysqldump -l -h localhost -u swad -p swad actions > actions.sql
mysqldump -l -h localhost -u swad -p swad countries > countries.sql
mysqldump -l -h localhost -u swad -p swad institutions > institutions.sql
mysqldump -l -h localhost -u swad -p swad centres > centres.sql
(optional)
mysqldump -l -h localhost -u swad -p swad deg_types > deg_types.sql
(optional)
mysqldump -l -h localhost -u swad -p swad degrees > degrees.sql
(optional)
mysqldump -l -h localhost -u swad -p swad departments > departments.sql
(optional)
mysqldump -l -h localhost -u swad -p swad mail_domains > mail_domains.sql
(optional)
mysqldump -l -h localhost -u swad -p swad places > places.sql
(optional)
Move to this directory and create the contents of the respective tables
in database::
cd /home/<user_directory>/swad/swad-core/sql
mysql -u swad -p swad < actions.sql
mysql -u swad -p swad < countries.sql
mysql -u swad -p swad < institutions.sql
mysql -u swad -p swad < centres.sql
(optional)
mysql -u swad -p swad < deg_types.sql
(optional)
mysql -u swad -p swad < degrees.sql
(optional)
mysql -u swad -p swad < departments.sql
(optional)
mysql -u swad -p swad < mail_domains.sql
(optional)
mysql -u swad -p swad < places.sql
(optional)
Create a superuser:
mysql -u swad -p swad
mysql> SET @MyID:='my_id';
Instead of my_id
we should use our ID number (DNI / cédula / passport...).
mysql> SET @EncryptedUsrCod:='base64url_string_43_chars';
Instead of base64url_string_43_chars
we will use a random 43 characters string where every character
can be one of the following 64 ones (they can be repeated):
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'0','1','2','3','4','5','6','7','8','9','-','_'
mysql> INSERT INTO usr_data (EncryptedUsrCod,Comments) VALUES(@EncryptedUsrCod,'');
mysql> INSERT INTO usr_IDs (UsrCod,UsrID,CreatTime,Confirmed) VALUES(LAST_INSERT_ID(),@MyID,NOW(),'Y');
mysql> INSERT INTO admin (UsrCod,Scope,Cod) VALUES (LAST_INSERT_ID(),'Sys','0');
mysql> quit
-
Hereinafter, SWAD will use three main directories:
- The directory for SWAD executable programs.
It is either the
cgi-bin
main directory or a child of it.
Usually we will create a directory swad
inside the directory cgi-bin
,
so that the directory for SWAD executable programs will be:
CentOS 6.5 |
Ubuntu 14.04 |
/var/www/cgi-bin/swad/
|
/usr/lib/cgi-bin/swad/
|
- The directory for SWAD public pages.
It may be the main directory for public pages
or either it may be a child of it:
CentOS 6.5 |
Ubuntu 14.04 |
/var/www/html/swad/
|
/var/www/html/swad/
|
- The directory for SWAD private data.
It may be in any place not visible in the web:
CentOS 6.5 |
Ubuntu 14.04 |
/var/www/swad/
|
/var/www/swad/
|
The directory swad
inside cgi-bin
,
will be created later.
Create the public directory swad
,
that will store the SWAD public content,
inside the main public directory:
CentOS 6.5 |
Ubuntu 14.04 |
mkdir /var/www/html/swad
|
sudo mkdir /var/www/html/swad
|
Create the public directory crs
, that will store the public content
of the courses, inside the SWAD public directory:
CentOS 6.5 |
Ubuntu 14.04 |
mkdir /var/www/html/swad/crs
|
sudo mkdir /var/www/html/swad/crs
|
Create the directory private swad
, that will store the SWAD private content,
inside a directory not visible by browsers:
CentOS 6.5 |
Ubuntu 14.04 |
mkdir /var/www/swad
|
sudo mkdir /var/www/swad
|
Create the private directory crs
, that will store the private content
of the courses, inside the SWAD private directory:
CentOS 6.5 |
Ubuntu 14.04 |
mkdir /var/www/swad/crs
|
sudo mkdir /var/www/swad/crs
|
Change the owner of the public and private directories:
CentOS 6.5 |
Ubuntu 14.04 |
chown -R apache:apache /var/www/html/swad /var/www/swad
|
sudo chown -R www-data:www-data /var/www/html/swad /var/www/swad
|
To show the icon in the address bar of browser, we can put a file favicon.ico
in the main web directory:
CentOS 6.5 |
Ubuntu 14.04 |
/var/www/html/
Sometimes in CentOS SELinux is activated,
and it will be necessary to change the permissions of the file favicon.ico :
ls -lZ /var/www/html/favicon.ico
chcon -t httpd_sys_content_t /var/www/html/favicon.ico
ls -lZ /var/www/html/favicon.ico
|
/var/www/html/
|
This favicon could be distinct from the SWAD logo.
In the file favicon.ico
included inside the directory icon
indicated below, there is a SWAD icon that wil be shown when the platform is on screen.
-
In the directory /home/<user_directory>/swad/swad-core
it should exist a directory icon
that must be copied into the SWAD public directory:
CentOS 6.5 |
Ubuntu 14.04 |
cp -R /home/<user_directory>/swad/swad-core/icon /var/www/html/swad/
chown -R apache:apache /var/www/html/swad/icon
If in CentOS SELinux is activated,
it should be necessary to change the permissions of the directory icon and its contents:
ls -lZ /var/www/html/swad/
chcon -R -t httpd_sys_content_t /var/www/html/swad/icon
ls -lZ /var/www/html/swad/
|
sudo cp -R /home/<user_directory>/swad/swad-core/icon /var/www/html/swad/
sudo chown -R www-data:www-data /var/www/html/swad/icon
|
-
jstz,
available in https://bitbucket.org/pellepim/jstimezonedetect/
or http://pellepim.bitbucket.org/jstz/,
is a Javascript script used by SWAD to get the user's time zone.
For example, if the user's operating system is configured with local time of Madrid (Spain),
the script jstz.js
running in the user's browser
determines a user's time zone "Europe/Berlin".
This user's time zone name is necessary to compute some stats of page hits
using user's local time instead of server time.
The script jstz.js
is available in:
https://bitbucket.org/pellepim/jstimezonedetect/ >
Downloads >
Download repository >
pellepim-jstimezonedetect-xxxxxxxxxxxx.zip >
dist >
jstz.js
To install it, we must copy the directory jstz
,
located inside the directory /home/<user_directory>/swad/swad-core
,
to the SWAD public directory:
CentOS 6.5 |
Ubuntu 14.04 |
cp -R /home/<user_directory>/swad/swad-core/jstz /var/www/html/swad/
chown -R apache:apache /var/www/html/swad/jstz
If in CentOS SELinux is activated,
it should be necessary to change the permissions of the directory jstz and its contents:
ls -lZ /var/www/html/swad/
chcon -R -t httpd_sys_content_t /var/www/html/swad/jstz
ls -lZ /var/www/html/swad/
|
sudo cp -R /home/<user_directory>/swad/swad-core/jstz /var/www/html/swad/
sudo chown -R www-data:www-data /var/www/html/swad/jstz
|
After installation, we must populate the Time Zone Tables
in our mysql database by following the instructions in
http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
-
DropzoneJS is a Javascript library required to upload
one or more files using drag and drop.
To install it, we must copy the directory dropzone
,
located inside the directory /home/<user_directory>/swad/swad-core
,
to the SWAD public directory:
CentOS 6.5 |
Ubuntu 14.04 |
cp -R /home/<user_directory>/swad/swad-core/dropzone /var/www/html/swad/
chown -R apache:apache /var/www/html/swad/dropzone
If in CentOS SELinux is activated,
it should be necessary to change the permissions of the directory dropzone and its contents:
ls -lZ /var/www/html/swad/
chcon -R -t httpd_sys_content_t /var/www/html/swad/dropzone
ls -lZ /var/www/html/swad/
|
sudo cp -R /home/<user_directory>/swad/swad-core/dropzone /var/www/html/swad/
sudo chown -R www-data:www-data /var/www/html/swad/dropzone
|
-
MathJax is a Javascript library required to display math.
In SWAD, it is used in combination with Markdown and Pandoc.
To install it, follow the instructions in
http://docs.mathjax.org/en/latest/installation.html.
The directory downloaded and uncompressed must be located inside our main HTML directory
/var/www/html/swad/
:
CentOS 6.5 |
Ubuntu 14.04 |
mv our-downloaded-copy-of-mathjax /var/www/html/swad/MathJax
chown -R apache:apache /var/www/html/swad/MathJax
If in CentOS SELinux is activated,
it should be necessary to change the permissions of the directory dropzone and its contents:
ls -lZ /var/www/html/swad/
chcon -R -t httpd_sys_content_t /var/www/html/swad/MathJax
ls -lZ /var/www/html/swad/
|
sudo mv our-downloaded-copy-of-mathjax /var/www/html/swad/MathJax
sudo chown -R www-data:www-data /var/www/html/swad/MathJax
|
-
Install yacc if not installed:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install byacc
|
sudo apt-get install byacc
|
Install flex if not installed:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install flex
|
sudo apt-get install flex
|
Install GNU bison if not installed:
CentOS 6.5 |
Ubuntu 14.04 |
yum -y install bison bison-devel
|
sudo apt-get install bison
|
Install the library ssl
if not installed:
CentOS 6.5 |
Ubuntu 14.04 |
|
sudo apt-get install libssl-dev
|
We need to install the gSOAP toolkit,
that can be downloaded from:
http://www.cs.fsu.edu/~engelen/soap.html
http://sourceforge.net/projects/gsoap2/files/
(Tested with the version 2.8.30,
probably more recent versions also work.)
Inside /home/<user_directory>/swad
, create a directory gsoap
:
mkdir /home/<user_directory>/swad/gsoap
Go to directory /home/<user_directory>/swad/gsoap
:
cd /home/<user_directory>/swad/gsoap
Download the file gsoap_2.8.30.zip
(or later)
and copy it in /home/<user_directory>/swad/gsoap
wget http://downloads.sourceforge.net/project/gsoap2/gSOAP/gsoap_2.8.30.zip
Uncompress gSOAP:
unzip gsoap_2.8.30.zip
(or later)
It should have been created the directory gsoap-2.8
. Go to that directory:
cd gsoap-2.8
Configure:
./configure
Check if all the necessary packages are installed. Otherwise, install them.
Compile:
make
Install:
CentOS 6.5 |
Ubuntu 14.04 |
make install
|
sudo make install
|
-
We asume that the public and private directories have been created,
and the source code of SWAD core
is in /home/<user_directory>/swad/swad-core
.
Go to directory /home/<user_directory>/swad/swad-core/soap
:
cd /home/<user_directory>/swad/swad-core/soap
Edit the file swad_web_service.h
. Search the line:
//gsoap swad service location: URL
Replace URL
(everything after the two points)
by our SWAD address,
for example https://openswad.org/
or https://swad.ugr.es/
,
and save the file.
Compile the SWAD web service:
soapcpp2 -c -S swad_web_service.h
Copy the file WSDL just created (swad.wsdl
) to a public location:
CentOS 6.5 |
Ubuntu 14.04 |
mkdir /var/www/html/swad/ws/
cp /home/<user_directory>/swad/swad-core/soap/swad.wsdl /var/www/html/swad/ws/
|
sudo mkdir /var/www/html/swad/ws/
sudo cp -a /home/<user_directory>/swad/swad-core/soap/swad.wsdl /var/www/html/swad/ws/
|
Go to directory /home/<user_directory>/swad/swad-core/sha2
:
cd /home/<user_directory>/swad/swad-core/sha2
to compile sha2
:
gcc -O2 -c sha2.c -o sha2.o
Return to directory /home/<user_directory>/swad/swad-core
:
cd /home/<user_directory>/swad/swad-core
Edit the file swad.cfg
making the necessary modifications and save it.
Copy the file swad.cfg
just edited to SWAD directory for executable programs:
CentOS 6.5 |
Ubuntu 14.04 |
cp -a /home/<user_directory>/swad/swad-core/swad.cfg /var/www/cgi-bin/swad/
|
sudo cp -a /home/<user_directory>/swad/swad-core/swad.cfg /usr/lib/cgi-bin/swad/
|
Edit the file swad_config.h
making the necessary modifications and save it.
If the directories or other constants
indicated in the file swad_config.h
change,
we must modify swad_config.h
and recompile the SWAD core.
Compile SWAD core:
make clean; make
An executable file for each language should have been created:
swad_ca
swad_de
swad_en
swad_es
swad_fr
swad_gn
swad_it
swad_pl
swad_pt
Create the directory of SWAD executable programs, if not exist:
CentOS 6.5 |
Ubuntu 14.04 |
mkdir /var/www/cgi-bin/swad/
|
sudo mkdir /usr/lib/cgi-bin/swad/
|
Edit the script swad_copy.sh
,
in the directory /home/<user_directory>/swad/swad-core
.
The content of the script swad_copy.sh
should be similar to this:
CentOS 6.5 |
Ubuntu 14.04 |
#!/bin/bash
CGI=/var/www/cgi-bin/swad
PUBLIC_HTML=/var/www/html/swad
APACHE_USER=apache
APACHE_GROUP=apache
USER=<user>
CORE=/home/$USER/swad/swad-core
cp -af $CGI/swad_ca $CGI/swad_ca.old
cp -af $CGI/swad_de $CGI/swad_de.old
cp -af $CGI/swad_en $CGI/swad_en.old
cp -af $CGI/swad_es $CGI/swad_es.old
cp -af $CGI/swad_fr $CGI/swad_fr.old
cp -af $CGI/swad_gn $CGI/swad_gn.old
cp -af $CGI/swad_it $CGI/swad_it.old
cp -af $CGI/swad_pl $CGI/swad_pl.old
cp -af $CGI/swad_pt $CGI/swad_pt.old
cp -f $CORE/swad_ca $CORE/swad_de $CORE/swad_en $CORE/swad_es $CORE/swad_fr $CORE/swad_gn $CORE/swad_it $CORE/swad_pl $CORE/swad_pt $CGI
cp -f $CORE/js/swad.js $PUBLIC_HTML
cp -f $CORE/css/swad_desktop.css $CORE/css/swad_mobile.css $PUBLIC_HTML
chown -R $APACHE_USER:$APACHE_GROUP $CGI
chown $APACHE_USER:$APACHE_GROUP $PUBLIC_HTML/swad.js
chown $APACHE_USER:$APACHE_GROUP $PUBLIC_HTML/swad_desktop.css
chown $APACHE_USER:$APACHE_GROUP $PUBLIC_HTML/swad_mobile.css
|
#!/bin/bash
CGI=/usr/lib/cgi-bin/swad
PUBLIC_HTML=/var/www/html/swad
APACHE_USER=www-data
APACHE_GROUP=www-data
USER=<user>
CORE=/home/$USER/swad/swad-core
cp -af $CGI/swad_ca $CGI/swad_ca.old
cp -af $CGI/swad_de $CGI/swad_de.old
cp -af $CGI/swad_en $CGI/swad_en.old
cp -af $CGI/swad_es $CGI/swad_es.old
cp -af $CGI/swad_fr $CGI/swad_fr.old
cp -af $CGI/swad_gn $CGI/swad_gn.old
cp -af $CGI/swad_it $CGI/swad_it.old
cp -af $CGI/swad_pl $CGI/swad_pl.old
cp -af $CGI/swad_pt $CGI/swad_pt.old
cp -f $CORE/swad_ca $CORE/swad_de $CORE/swad_en $CORE/swad_es $CORE/swad_fr $CORE/swad_gn $CORE/swad_it $CORE/swad_pl $CORE/swad_pt $CGI
cp -f $CORE/js/swad.js $PUBLIC_HTML
cp -f $CORE/css/swad_desktop.css $CORE/css/swad_mobile.css $PUBLIC_HTML
chown -R $APACHE_USER:$APACHE_GROUP $CGI
chown $APACHE_USER:$APACHE_GROUP $PUBLIC_HTML/swad.js
chown $APACHE_USER:$APACHE_GROUP $PUBLIC_HTML/swad_desktop.css
chown $APACHE_USER:$APACHE_GROUP $PUBLIC_HTML/swad_mobile.css
|
Change the directories indicated in the script by the correct ones and save it.
Copy the script swad_copy.sh
to SWAD directory for executable programs
and give execution permission to the file swad_copy.sh
:
CentOS 6.5 |
Ubuntu 14.04 |
cp -a /home/<user_directory>/swad/swad-core/swad_copy.sh /var/www/cgi-bin/swad/
chmod a+x /var/www/cgi-bin/swad/swad_copy.sh
|
sudo cp -a /home/<user_directory>/swad/swad-core/swad_copy.sh /usr/lib/cgi-bin/swad/
sudo chmod a+x /usr/lib/cgi-bin/swad/swad_copy.sh
|
Run the script swad_copy.sh
now and every time we compile SWAD if we want to update the executables:
CentOS 6.5 |
Ubuntu 14.04 |
/var/www/cgi-bin/swad/swad_copy.sh
|
sudo /usr/lib/cgi-bin/swad/swad_copy.sh
|
Now, SWAD should work in:
https://our_server/swad/
However, it is still necessary to install other programs, as detailed below.
-
Before compiling a program that uses OpenCV, we must do this:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
export PKG_CONFIG_PATH
The source code of photo processing program fotomaton
is available in the forge de GitHub:
https://github.com/dcalandria/swad-fotomaton
We can compile this program in the local directory:
cd /home/<user_directory>/swad
Download the program from the forge using the following command:
git clone git://github.com/dcalandria/swad-fotomaton.git
This will create the directory swad-fotomaton
inside /home/<user_directory>/swad
.
Go to directory swad-fotomaton
:
cd swad-fotomaton
And compile:
make
As result, it should have been created an executable file fotomaton
.
Try to execute the program directly to check that there are no errors in libraries:
./fotomaton
If there are errors related with OpenCV libraries, check what libraries use OpenCV:
pkg-config --libs opencv
Create a file called opencv.conf
in /etc/ld.so.conf.d/
that holds the path to the OpenCV libraries (by default /usr/local/lib
),
and then run ldconfig
as root
:
ldconfig
Or either, add the location of the OpenCV libraries
to LD_LIBRARY_PATH
.
Copy the executable file fotomaton
created after the make, into the directory of SWAD executable programs:
CentOS 6.5 |
Ubuntu 14.04 |
cp -a ./fotomaton /var/www/cgi-bin/swad/
Sometimes in CentOS SELinux is activated,
and it could be necessary to change the permissions of the file fotomaton :
ls -lZ /var/www/cgi-bin/swad/
chcon -t httpd_sys_script_exec_t /var/www/cgi-bin/swad/fotomaton
ls -lZ /var/www/cgi-bin/swad/
|
sudo cp -a ./fotomaton /usr/lib/cgi-bin/swad/
|
To make fotomaton
work, the correct call is:
fotomaton <classifier> <input_file> <width>
The first parameter is a data file that is needed by face recognizer,
and that we must place in the same directory where we have copied the program fotomaton
.
In the package downloaded from GitHub or in the directory
/home/<user_directory>/swad/swad-core/fotomaton_data
we should find a file options
that holds these data
necessary for the face recognizer.
Copy it in the same directory of SWAD executable programs
where we have copied the executable fotomaton
:
CentOS 6.5 |
Ubuntu 14.04 |
cp -a /home/<user_directory>/swad/swad-core/fotomaton_data/options /var/www/cgi-bin/swad/
chown -R apache:apache /var/www/cgi-bin/swad/options
Sometimes in CentOS SELinux is activated,
and it could be necessary to change the permissions of the file options :
ls -lZ /var/www/cgi-bin/swad/
chcon -t httpd_sys_content_t /var/www/cgi-bin/swad/options
ls -lZ /var/www/cgi-bin/swad/
|
sudo cp -a /home/<user_directory>/swad/swad-core/fotomaton_data/options /usr/lib/cgi-bin/swad/
sudo chown -R www-data:www-data /usr/lib/cgi-bin/swad/options
|
-
Before compiling a program that uses OpenCV, we must do this:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
export PKG_CONFIG_PATH
The source code of the programs foto_mediana
and foto_promedio
,
that calculate respectively the median and the average (pixel by pixel) of several photos,
is available in the GitHub forge:
https://github.com/dcalandria/foto_promedio
We can compile these two programs in the local directory:
cd /home/<user_directory>/swad
Download the programs from repository using the following command:
git clone git://github.com/dcalandria/foto_promedio.git
This will create the directory foto-promedio
inside /home/<user_directory>/swad
.
Go to directory foto_promedio
:
cd /home/<user_directory>/swad
cd foto_promedio
And compile:
make
As result it should have been created the executable files
foto_mediana
and foto_promedio
.
Copy the executable files foto_mediana
and foto_promedio
,
created after the make, to the directory of SWAD executables:
CentOS 6.5 |
Ubuntu 14.04 |
cp -a /home/<user_directory>/swad/foto_promedio/foto_mediana /var/www/cgi-bin/swad/
cp -a /home/<user_directory>/swad/foto_promedio/foto_promedio /var/www/cgi-bin/swad/
Sometimes in CentOS SELinux is activated,
and it could be necessary to change the permissions of the files
foto_mediana and foto_promedio :
ls -lZ /var/www/cgi-bin/swad/
chcon -t httpd_sys_script_exec_t /var/www/cgi-bin/swad/foto_mediana
chcon -t httpd_sys_script_exec_t /var/www/cgi-bin/swad/foto_promedio
ls -lZ /var/www/cgi-bin/swad/
|
sudo cp -a /home/<user_directory>/swad/foto_promedio/foto_mediana /usr/lib/cgi-bin/swad/
sudo cp -a /home/<user_directory>/swad/foto_promedio/foto_promedio /usr/lib/cgi-bin/swad/
|
-
The source code of chat server swad-ircd
is available in the GitHub forge:
https://github.com/dcalandria/swad-ircd
We can make the compilation of this program in the local directory:
cd /home/<user_directory>/swad
Download the program from repository using the following command:
git clone git://github.com/dcalandria/swad-ircd.git
This will create the directory swad-ircd
inside /home/<user_directory>/swad
.
Go to directory swad-ircd
:
cd swad-ircd
Compile:
make
As result it should have been created an executable file swad_ircd
.
For reasons of order, copy the executable file swad_ircd
created after the make in the directory of SWAD executables:
CentOS 6.5 |
Ubuntu 14.04 |
cp -a /home/<user_directory>/swad/swad-ircd/swad_ircd /var/www/cgi-bin/swad/
Sometimes in CentOS SELinux is activated,
and it could be necessary change the permissions of file swad_ircd :
ls -lZ /var/www/cgi-bin/swad/
chcon -t httpd_sys_script_exec_t /var/www/cgi-bin/swad/swad_ircd
ls -lZ /var/www/cgi-bin/swad/
|
sudo cp -a /home/<user_directory>/swad/swad-ircd/swad_ircd /usr/lib/cgi-bin/swad/
|
Actually this program is a daemon that always shall be in execution,
and it could be placed in any directory.
Go to directory of SWAD executables
and run the daemon swad-ircd
as root
:
CentOS 6.5 |
Ubuntu 14.04 |
cd /var/www/cgi-bin/swad/
nohup ./swad_ircd &
|
cd /usr/lib/cgi-bin/swad/
sudo nohup ./swad_ircd &
|
In the local directory /home/<user_directory>/swad/swad-core
it should exist a directory chat
, with two files:
Check it:
cd /home/<user_directory>/swad/swad-core/chat
ls -l
Create a directory chat
in the public directory for web pages of SWAD
and copy the file swad_chat.jar
in that directory:
CentOS 6.5 |
Ubuntu 14.04 |
mkdir /var/www/html/swad/chat
cp /home/<user_directory>/swad/swad-core/chat/swad_chat.jar /var/www/html/swad/chat
|
sudo mkdir /var/www/html/swad/chat
sudo cp -a /home/<user_directory>/swad/swad-core/chat/swad_chat.jar /var/www/html/swad/chat
|
Edit the file chat.html
, change all the paths and URLs in order to reflect
the particular configuration of our server, and save it.
Copy the modified file chat.html
in the directory of SWAD executables:
CentOS 6.5 |
Ubuntu 14.04 |
cp /home/<user_directory>/swad/swad-core/chat/chat.html /var/www/cgi-bin/swad/
Sometimes in CentOS SELinux is activated,
and it should be necessary to change the permissions of the file chat.html :
ls -lZ /var/www/cgi-bin/swad/
chcon -t httpd_sys_content_t /var/www/cgi-bin/swad/chat.html
ls -lZ /var/www/cgi-bin/swad/
|
sudo cp -a /home/<user_directory>/swad/swad-core/chat/chat.html /usr/lib/cgi-bin/swad/
|
Finally, it is necessary to open the port 5000, through which the chat server
comunicates with the clients.
CentOS 6.5 |
Ubuntu 14.04 |
To activate permanently the port 5000,
in CentOS we can edit the file /etc/sysconfig/iptables
and add a line like the following:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5000 -j ACCEPT
It will be necessary to restart the iptables service:
/sbin/service iptables restart
|
To activate permanently the port 5000,
in Ubuntu we can execute the following commands:
sudo iptables -A INPUT -p tcp --dport 5000 -j ACCEPT
sudo iptables-save
|
-
Copy the script swad_smtp.py
,
that should be in the directory /home/<user_directory>/swad/swad-core/py
,
to the directory of SWAD executables.
Then give execution permission to file swad_smtp.py
:
CentOS 6.5 |
Ubuntu 14.04 |
cp /home/<user_directory>/swad/swad-core/py/swad_smtp.py /var/www/cgi-bin/swad/
chmod a+x /var/www/cgi-bin/swad/swad_smtp.py
Sometimes in CentOS SELinux is activated,
and it could be necessary to change the swad_smtp.py file permissions:
ls -lZ /var/www/cgi-bin/swad/
chcon -t httpd_sys_script_exec_t /var/www/cgi-bin/swad/swad_smtp.py
ls -lZ /var/www/cgi-bin/swad/
This script connects to the network to send emails.
As stated in the manual of httpd_selinux,
if we want the script can connect to the network when SELinux is working,
it is necessary to activate httpd_can_network_connect :
setsebool -P httpd_can_network_connect 1
|
sudo cp -a /home/<user_directory>/swad/swad-core/py/swad_smtp.py /usr/lib/cgi-bin/swad/
sudo chmod a+x /usr/lib/cgi-bin/swad/swad_smtp.py
|
The script swad_smtp.py
has been tested to work properly
with Python 2.6.6 and Python 2.7.1. If it does not work, try to upgrade Python.
-
It is desirable that MySQL, Apache and chat servers start automatically when the server is reset.
CentOS 6.5 |
Ubuntu 14.04 |
chkconfig httpd on
chkconfig mysqld on
chkconfig --list
And we can add to file /etc/rc.d/rc.local the following line:
/var/www/cgi-bin/swad/swad_ircd &
|
sudo update-rc.d mysql defaults
sudo update-rc.d apache2 defaults
We can add to file /etc/rc.local the following line before exit 0 :
/usr/lib/cgi-bin/swad/swad_ircd &
|
-
If the server used to send e-mail is our server,
we need to check that an SMTP mail server is installed,
and if not, install and start it.
In CentOS 6.5 we can install and configure it by following these instructions:
Installing and configuring Postfix and Dovecot
We can install and configure
Postfix and
Dovecot
by following the instructions in
http://www.krizna.com/centos/setup-mail-server-in-centos-6/,
http://wiki.centos.org/HowTos/postfix,
http://www.ostechnix.com/setup-mail-server-using-postfixdovecotsquirrelmail-in-centosrhelscientific-linux-6-3-step-by-step/, or
http://www.server-world.info/en/note?os=CentOS_5&p=mail.
Settings to become a trusted mail server
If we want email providers, like GMail, to accept emails coming from our server
instead of rejecting them or labeling them as SPAM,
it is necessary to perform various settings detailed in this section.
Activating reverse DNS
We have activated Reverse DNS for our IPv4 address in our server by following the rules from
http://wiki.hetzner.de/index.php/DNS-Reverse-DNS/en.
Instructions say that the address used for the mail command HELO should be used.
Our reverse DNS is mail.openswad.org
.
Finally, we have also activated Reverse DNS from our IPv6 to mail.openswad.org
.
If we write the command
nslookup our-server-IPV6-address
,
the result is mail.openswad.org
.
Setting SPF
SPF (Sender Policy Framework)
is an open standard specifying a technical method to prevent sender address forgery.
By following instructions in:
https://support.google.com/mail/answer/9008
https://support.google.com/a/answer/183895
http://wiki.hetzner.de/index.php/DNS_SPF/en
we have added the following TXT record at the end of our DNS configuration page:
@ IN TXT "v=spf1 a mx ip6:our-server-ipv6-address ~all"
Installing and setting DKIM
We need to install OpenDKIM to sign emails.
Following the instructions in
https://www.rosehosting.com/blog/how-to-install-and-integrate-opendkim-with-postfix-on-a-centos-6-vps/:
yum install opendkim
Make a copy of configuration file:
cd /etc
cp -a opendkim.conf opendkim.conf.original
and edit file opendkin.conf
:
vim /etc/opendkim.conf
-
Change option:
Mode v
to:
Mode sv
-
Comment the line:
# KeyFile /etc/opendkim/keys/default.private
and add this:
KeyFile /etc/opendkim/keys/openswad.org/default
-
Uncomment the lines:
KeyTable /etc/opendkim/KeyTable
SigningTable refile:/etc/opendkim/SigningTable
ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
InternalHosts refile:/etc/opendkim/TrustedHosts
Generate set of keys for our mydomain.com domain name:
mkdir /etc/opendkim/keys/openswad.org
opendkim-genkey -D /etc/opendkim/keys/openswad.org/ -d openswad.org -s default
chown -R opendkim: /etc/opendkim/keys/openswad.org
mv /etc/opendkim/keys/openswad.org/default.private /etc/opendkim/keys/openswad.org/default
Edit /etc/opendkim/KeyTable
:
cd /etc/opendkim
cp -a KeyTable KeyTable.original
vim /etc/opendkim/KeyTable
and add the following record to OpenDKIM's key table /etc/opendkim/KeyTable
:
default._domainkey.openswad.org openswad.org:default:/etc/opendkim/keys/openswad.org/default
Edit /etc/opendkim/SigningTable
:
cd /etc/opendkim
cp -a SigningTable SigningTable.original
vim /etc/opendkim/SigningTable
and add the following record to OpenDKIM's signing table /etc/opendkim/SigningTable
:
*@openswad.org default._domainkey.openswad.org
Add our domain and our hostname as trusted hosts in /etc/opendkim/TrustedHosts
:
cd /etc/opendkim
cp -a TrustedHosts TrustedHosts.original
vim /etc/opendkim/TrustedHosts
We add the following lines:
openswad.org
mail.openswad.org
Edit our DNS zone and add the TXT record from
/etc/opendkim/keys/mydomain.com/default.txt
:
cat /etc/opendkim/keys/openswad.org/default.txt
We add something like this:
default._domainkey IN TXT ( "v=DKIM1; k=rsa; "
"p=our-DKIM-key" ) ; ----- DKIM key default for openswad.org
In order to integrate OpenDKIM with Postfix
we need to edit /etc/postfix/main.cf
:
vim /etc/postfix/main.cf
and add the following few lines:
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept
milter_protocol = 2
Finally, add OpenDKIM to our system's start-up
and start opendkim and restart postfix using the following commands:
service opendkim start
chkconfig opendkim on
service postfix restart
Setting DMARC
Finally, we add a DMARC record to our DNS
by following the recommendations of
https://support.google.com/a/answer/2466563:
_dmarc IN TXT "v=DMARC1; p=none; rua=mailto:postmaster@our-domain"
Final test
After the settings, we can check the health of our mail domain using web tests like this:
http://mxtoolbox.com/domain/openswad.org/