Mediawiki/Installing/Ubuntu
| (10 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | [[Mediawiki/Installing|Installing]] | [[Mediawiki/MultipleInstances|Multiple Instances]] | [[Mediawiki/Installing/Ubuntu|Ubuntu Installation]] | + | [[Mediawiki/Installing|Installing]] | [[Mediawiki/MultipleInstances|Multiple Instances]] | [[Mediawiki/Installing/Ubuntu|Ubuntu Installation]] | [[Mediawiki/Installing/CentOS7|CentOS7 Installation]] |
==Installation Overview== | ==Installation Overview== | ||
| Line 6: | Line 6: | ||
==Install required packages== | ==Install required packages== | ||
Below is a list of all the packages required by Mediawiki for installation on Ubuntu. | Below is a list of all the packages required by Mediawiki for installation on Ubuntu. | ||
| − | ~$ sudo apt-get update && sudo apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-php5 ImageMagick | + | ~$ sudo apt-get update && sudo apt-get install -y apache2 mysql-server php5 php5-mysql libapache2-mod-php5 ImageMagick php5-intl |
Alternatively, if you think you have already installed some of the packages, you can quickly check | Alternatively, if you think you have already installed some of the packages, you can quickly check | ||
~$ dpkg -s [package name] | grep Status | ~$ dpkg -s [package name] | grep Status | ||
| Line 14: | Line 14: | ||
==setup mysql== | ==setup mysql== | ||
make sure mysql is started | make sure mysql is started | ||
| − | ~$ sudo service | + | ~$ sudo service mysql status |
or | or | ||
| − | ~$ sudo service | + | ~$ sudo service mysql start |
setup the basics | setup the basics | ||
~$ sudo mysql_secure_installation | ~$ sudo mysql_secure_installation | ||
| Line 50: | Line 50: | ||
+---------------------------------------------------------------------------------------------------------------+ | +---------------------------------------------------------------------------------------------------------------+ | ||
1 row in set (0.00 sec) | 1 row in set (0.00 sec) | ||
| + | |||
==download mediawiki and verify== | ==download mediawiki and verify== | ||
http://www.mediawiki.org/wiki/Download<br> | http://www.mediawiki.org/wiki/Download<br> | ||
| Line 58: | Line 59: | ||
~$ wget http://releases.wikimedia.org/mediawiki/1.22/mediawiki-1.22.6.tar.gz.sig | ~$ wget http://releases.wikimedia.org/mediawiki/1.22/mediawiki-1.22.6.tar.gz.sig | ||
gpg keys | gpg keys | ||
| − | ~$ | + | ~$ wget https://www.mediawiki.org/keys/keys.txt |
import keys | import keys | ||
~$ gpg --import keys.txt | ~$ gpg --import keys.txt | ||
| Line 75: | Line 76: | ||
~$ sudo pwd | ~$ sudo pwd | ||
/home/user/downloads/ | /home/user/downloads/ | ||
| + | ~$ sudo mkdir /var/www/html/sitename.com | ||
~$ sudo mkdir /var/www/html/sitename.com/wiki | ~$ sudo mkdir /var/www/html/sitename.com/wiki | ||
| − | ~$ tar xvzf mediawiki-1.22.6.tar.gz | + | ~$ tar xvzf ./mediawiki-1.22.6.tar.gz |
| − | ~$ sudo | + | ~$ sudo cp -avr ./mediawiki-1.22.6/. /var/www/html/sitename.com/wiki/ |
==Configure Apache2== | ==Configure Apache2== | ||
| Line 83: | Line 85: | ||
Since we're going with a subsite configuration, the virutalhost file is going to be simple and only point to the site's root directory | Since we're going with a subsite configuration, the virutalhost file is going to be simple and only point to the site's root directory | ||
~$ sudo vi /etc/apache2/sites-available/yoursite.com.conf | ~$ sudo vi /etc/apache2/sites-available/yoursite.com.conf | ||
| − | add: | + | add: |
<VirtualHost *:80> | <VirtualHost *:80> | ||
ServerName yoursite.com | ServerName yoursite.com | ||
| Line 91: | Line 93: | ||
ErrorLog /var/log/apache2/yoursite.com-error_log | ErrorLog /var/log/apache2/yoursite.com-error_log | ||
</VirtualHost> | </VirtualHost> | ||
| + | While you're configuring apache, let's harden security a little bit to prevent malicious upload attacks. | ||
| + | ~$ sudo vi /etc/apache2/sites-available/yoursite.com.conf | ||
| + | add to the bottom of your Virtual site config, before you close it: | ||
| + | <Directory /var/www/yoursite.com/wiki/images/> | ||
| + | # Ignore .htaccess files | ||
| + | AllowOverride None | ||
| + | # Serve HTML as plaintext, don't execute SHTML | ||
| + | AddType text/plain .html .htm .shtml .php | ||
| + | # Don't run arbitrary PHP code. | ||
| + | php_admin_flag engine off | ||
| + | # If you've other scripting languages, disable them too. | ||
| + | </Directory> | ||
| + | Restart Apache2 and make sure you dont get any errors | ||
| + | ~$ sudo service apache2 restart | ||
| + | * Restarting web server apache2 | ||
| + | ...done. | ||
| + | |||
| + | ==restart apache and finalize install== | ||
| + | |||
| + | ~$ sudo a2enmod yoursite.com.conf | ||
| + | ~$ sudo service apache2 restart | ||
| + | Browse to your site's URL<br> | ||
| + | it will let you know no LocalSettings.php file was found and give you a link to begin installation. This install script asks you a bunch of questions and will generate the LocalSettings.php based on your responses.<br> | ||
| + | Save the LocalSettings.php file and copy to your site's directory, which in this case was: | ||
| + | ~$ /var/www/html/servername/mediawiki-1.22.6/ | ||
| + | If you opted for Image Uploads, it would have asked for which directory deleted files will go in, by default it is /var/www/html/servername/mediawiki-1.22.6/images/deleted/, so do the following: | ||
| + | ~$ sudo mkdir /var/www/html/servername/mediawiki-1.22.6/images/deleted/ | ||
| + | ~$ sudo chown www-data:www-data /var/www/html/servername/mediawiki-1.22.6/images/deleted/ | ||
| + | Restart Apache | ||
| + | ~$ sudo service apache2 restart | ||
| + | Reload the page and your wiki should be operational or at least ready for further configuration. | ||
Latest revision as of 21:57, 21 August 2019
Installing | Multiple Instances | Ubuntu Installation | CentOS7 Installation
Contents |
[edit] Installation Overview
All of the instructions below were done on Ubuntu 14.04 LTS
[edit] Install required packages
Below is a list of all the packages required by Mediawiki for installation on Ubuntu.
~$ sudo apt-get update && sudo apt-get install -y apache2 mysql-server php5 php5-mysql libapache2-mod-php5 ImageMagick php5-intl
Alternatively, if you think you have already installed some of the packages, you can quickly check
~$ dpkg -s [package name] | grep Status
ie. ~$ dpkg -s imagemagick | grep Status
Status: install ok installed
[edit] setup mysql
make sure mysql is started
~$ sudo service mysql status or ~$ sudo service mysql start
setup the basics
~$ sudo mysql_secure_installation Set root password? [Y/n] y Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y
login to db
~$ mysql -u root -p
Create mysql wiki user
~$ mysql> CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED'; ~$ mysql> exit
login as new user to verify account works
~$ mysql -u wiki -p ~$ mysql> exit
create DB
~$ mysql -u root -p ~$ mysql> CREATE DATABASE sewikidatabase;
verify DB creation
~$ mysql> SHOW DATABASES;
assign rights to wiki user for new database created
~$ mysql> GRANT ALL PRIVILEGES ON sewikidatabase.* TO 'wiki'@'localhost' IDENTIFIED BY 'wikiuserpassword' WITH GRANT OPTION; ~$ mysql> exit
verify permissions have been granted
~$ mysql -u wiki -p ~$ mysql> SHOW GRANTS; +---------------------------------------------------------------------------------------------------------------+ | Grants for wiki@localhost | +---------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'wiki'@'localhost' IDENTIFIED BY PASSWORD '*2K21458K438UYE85A38B9Y7Y78DAEBF4T8689YK4' | | GRANT ALL PRIVILEGES ON `sewikidatabase`.* TO 'wiki'@'localhost' WITH GRANT OPTION | +---------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
[edit] download mediawiki and verify
http://www.mediawiki.org/wiki/Download
http://da44en.wordpress.com/2004/08/16/practical-gnupg/
download mediawiki
~$ wget http://releases.wikimedia.org/mediawiki/1.22/mediawiki-1.22.6.tar.gz
gpg signature
~$ wget http://releases.wikimedia.org/mediawiki/1.22/mediawiki-1.22.6.tar.gz.sig
gpg keys
~$ wget https://www.mediawiki.org/keys/keys.txt
import keys
~$ gpg --import keys.txt
verify file with detached sig
~$ gpg --verify mediawiki-1.22.6.tar.gz.sig mediawiki-1.22.6.tar.gz gpg: Signature made Thu 24 Apr 2014 07:42:22 PM EDT using RSA key ID 7F901A30 gpg: Good signature from "Mark A. Hershberger <[email protected]>" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 3CEF 8262 806D 3F0B 6BA1 DBDD 7956 EE47 7F90 1A30
This means the file was verified successfully
gpg: Good signature from "Mark A. Hershberger <[email protected]>"
[edit] create dir/export tar contents
unpack mediawiki in a temp directory
~$ sudo pwd /home/user/downloads/ ~$ sudo mkdir /var/www/html/sitename.com ~$ sudo mkdir /var/www/html/sitename.com/wiki ~$ tar xvzf ./mediawiki-1.22.6.tar.gz ~$ sudo cp -avr ./mediawiki-1.22.6/. /var/www/html/sitename.com/wiki/
[edit] Configure Apache2
Since we're going with a subsite configuration, the virutalhost file is going to be simple and only point to the site's root directory
~$ sudo vi /etc/apache2/sites-available/yoursite.com.conf
add:
<VirtualHost *:80>
ServerName yoursite.com
ServerAdmin [email protected]
DocumentRoot /var/www/yoursite.com
TransferLog /var/log/apache2/yoursite.com-access_log
ErrorLog /var/log/apache2/yoursite.com-error_log
</VirtualHost>
While you're configuring apache, let's harden security a little bit to prevent malicious upload attacks.
~$ sudo vi /etc/apache2/sites-available/yoursite.com.conf
add to the bottom of your Virtual site config, before you close it:
<Directory /var/www/yoursite.com/wiki/images/>
# Ignore .htaccess files
AllowOverride None
# Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php
# Don't run arbitrary PHP code.
php_admin_flag engine off
# If you've other scripting languages, disable them too.
</Directory>
Restart Apache2 and make sure you dont get any errors
~$ sudo service apache2 restart * Restarting web server apache2 ...done.
[edit] restart apache and finalize install
~$ sudo a2enmod yoursite.com.conf ~$ sudo service apache2 restart
Browse to your site's URL
it will let you know no LocalSettings.php file was found and give you a link to begin installation. This install script asks you a bunch of questions and will generate the LocalSettings.php based on your responses.
Save the LocalSettings.php file and copy to your site's directory, which in this case was:
~$ /var/www/html/servername/mediawiki-1.22.6/
If you opted for Image Uploads, it would have asked for which directory deleted files will go in, by default it is /var/www/html/servername/mediawiki-1.22.6/images/deleted/, so do the following:
~$ sudo mkdir /var/www/html/servername/mediawiki-1.22.6/images/deleted/ ~$ sudo chown www-data:www-data /var/www/html/servername/mediawiki-1.22.6/images/deleted/
Restart Apache
~$ sudo service apache2 restart
Reload the page and your wiki should be operational or at least ready for further configuration.