Media Wiki Install Guide
Jump to navigation
Jump to search
Install Via Docker
What to do
Begin by creating the init.sql and docker-compose.yml files, change the <> to suite your needs. The init file will limit access and the compose file will create two docker instances one for the db and the other for the app.
init.sql
GRANT ALL PRIVILEGES ON wikidbname.* TO 'wikidbuser'@'172.%.%.%' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;
docker-compose.yml
version: '3.8' services: db: image: mysql:8.0 container_name: <yourwiki-db> restart: always environment: MYSQL_ROOT_PASSWORD: <> MYSQL_DATABASE: <> MYSQL_USER: <> MYSQL_PASSWORD: <> ports: - "127.0.0.1:3306:3306" volumes: - db_data:/var/lib/mysql yourwiki: image: mediawiki:latest container_name: yourwiki restart: always ports: - "127.0.0.1:80:80" environment: - MEDIAWIKI_DB_TYPE=mysql - MEDIAWIKI_DB_HOST=db - MEDIAWIKI_DB_NAME=<> - MEDIAWIKI_DB_USER=<> - MEDIAWIKI_DB_PASSWORD=<> depends_on: - db volumes: - yourwiki_data:/var/www/html/images - ./init.sql:/docker-entrypoint-initdb.d/init.sql volumes: db_data: yourwiki_data:
Build Environment
- Build the docker contianers
docker-compose up -d
- Get the IP address of the db so you can enter that in instead of local host on the media wiki installation
docker inspect yourwiki | grep -i IPAddress
- Copy the LocalSettings.php after you've finished installing
docker cp ~/Downloads/yourwikiLocalSettings.php yourwiki:/var/www/html/LocalSettings.php
Helpful Docker Commands
General Docker Commands
# logs you into the container docker exec -it <container name/id> bash # gets the associated IPs of the docker containers docker inspect yourwiki | grep -i ip # shuts down the container(s) docker stop <container name(s)/id(s) # deletes down the container(s) docker remove <container name(s)/id(s) # Setup containers from a compose file docker-compose up -d # builds the docker-compose.yml file
Troubleshooting
- If you add a single tic ' into your Wiki name you will need to edit the LocalSettings.php file and change the single ' to double " within the $wgSitename variable and possibly $wgMetaNamespace variable
Install on Hardware/VM
https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Fedora dnf update -y dnf install -y mariadb httpd mariadb-server php php-pear php-xml php-pdo_mysql php-intl php-pecl-zendopcache php-gd php-mbstring ImageMagick-perl systemctl start mariadb systemctl enable MariaDB CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'localhost'; FLUSH PRIVILEGES;
Wiki Configuration
Enabling Image Uploads
vim /etc/php.ini
- file_uploads = On
./LocalSettings.php
- $wgEnableUploads = true;
chmod 755 ./images chcon -R -t httpd_sys_rw_content_t ./images chown -R apache:apache ./images