To install MediaWiki on Ubuntu using the terminal, you can follow these steps:
- Update System Packages: Open a terminal and update your system's package list to ensure you have the latest information about available packages.
sudo apt update
- Install Required Packages: MediaWiki requires a web server (typically Apache), a database (usually MySQL or MariaDB), and PHP. Install these packages:
sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql php-cli php-gd php-xml php-mbstring php-xmlrpc
During the installation of MySQL server, you will be prompted to set a root password for MySQL.
- Create MySQL Database and User: Log in to MySQL and create a new database and user for MediaWiki.
sudo mysql -u root -p
Once inside the MySQL console:
CREATE DATABASE mediawiki;
CREATE USER 'mediawikiuser'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL PRIVILEGES ON mediawiki.* TO 'mediawikiuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace 'your_password_here'
with a strong password of your choice.
-
Download and Extract MediaWiki:
Navigate to the
/var/www/html
directory and download the latest version of MediaWiki. You can find the link to the latest version on the MediaWiki website.
cd /var/www/html
sudo wget https://releases.wikimedia.org/mediawiki/1.37/mediawiki-1.37.0.tar.gz
sudo tar -xzvf mediawiki-1.37.0.tar.gz
sudo mv mediawiki-1.37.0 mediawiki
sudo chown -R www-data:www-data mediawiki
Adjust the version number as needed.
- Configure Apache: Create a virtual host configuration file for MediaWiki.
sudo nano /etc/apache2/sites-available/mediawiki.conf
Add the following configuration:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/mediawiki
ServerName your_domain_or_ip
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Replace your_domain_or_ip
with your server's domain name or IP address.
Enable the virtual host and reload Apache:
sudo a2ensite mediawiki.conf
sudo systemctl reload apache2
Complete Installation via Web Browser:
Open a web browser and navigate tohttp://your_domain_or_ip
. Follow the on-screen instructions to complete the MediaWiki installation. You'll need to enter the database details and set up an admin account.Finalize Configuration:
After the installation, you may need to adjust some permissions and settings. Refer to the MediaWiki Installation Guide for further information.
Remember that software versions and URLs may change over time, so make sure to refer to the official MediaWiki documentation for the most up-to-date instructions.
Top comments (0)