This guide covers the setup process for the Africa CDC Knowledge Hub on both Windows and Linux environments.
Ensure you have the following installed:
- Operating System: Windows, Linux, or macOS
- Web Server: Apache or Nginx
- Database: MySQL or MariaDB
- PHP Version: 8.x or later
- Node.js Version: 16.x or later
- Composer: PHP dependency manager
- Git: Version control
- Redis (Optional but recommended for caching)
-
To set up PHP, MySQL, and Apache, download and install WAMP or XAMPP:
-
Follow the installation instructions for either WAMP or XAMPP.
- Download and install Composer from here to manage PHP dependencies.
- Download and install Node.js from here for JavaScript dependency management.
To install Apache, MySQL, and PHP on a Linux (Ubuntu) system, follow these steps:
sudo apt update
sudo apt install apache2
sudo apt install mysql-server
sudo apt install php libapache2-mod-php php-mysql
Install Composer on Linux:
sudo apt install composer
Install Node.js and npm:
sudo apt install nodejs
sudo apt install npm
Clone the Knowledge Hub repository from GitHub into your web server directory:
git clone https://github.com/Africa-cdc-Khub/knowledge_hub.git
For Windows:
- Extract the project into your XAMPP or WAMP htdocs folder:
C:/xampp/htdocs/knowledge_hub
For Linux:
- Place the folder in the Apache web root directory:
/var/www/html/knowledge_hub
-
Inside the project directory, create an .env file by copying the example file:
cp .env.example .env
-
Open the .env file and update the following variables with your database details:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=khub
DB_USERNAME=root
DB_PASSWORD=
- Configure other necessary environment settings:
STATES_ENABLED=TRUE
ADMIN_UNITS_ENABLED=FALSE
APP_URL=http://localhost/knowledge_hub
- Open phpMyAdmin and create a new database named
khub
. - Import the starter SQL file via the phpMyAdmin interface.
- Create the database and import the starter SQL file using the following command:
mysql -u root -p khub < path_to_starter_db.sql
Install PHP dependencies using Composer:
composer install --ignore-platform-reqs
Install JavaScript dependencies using npm:
npm install
Run the following commands to set up the database schema and populate it with initial data:
php artisan migrate
php artisan db:seed
php artisan storage:link
For Linux, ensure the correct folder permissions:
-
Set ownership for the project directory:
sudo chown -R $USER:$USER /var/www/html/knowledge_hub
-
Set the correct permissions for the project:
sudo chmod -R 755 /var/www/html/knowledge_hub sudo chmod -R 777 storage public
-
Open the XAMPP Control Panel and start Apache and MySQL.
-
Access the application in your browser:
http://localhost/knowledge_hub
-
Start Apache:
sudo service apache2 start
-
Access the application in your browser:
http://{server_ip}/knowledge_hub
Ensure that .htaccess files are enabled for Apache and that your virtual host configuration allows for URL rewrites.
Verify that the database credentials in the .env file are correct and that the MySQL/MariaDB server is running.
If you encounter permission errors, ensure the storage and public directories are writable by the web server:
sudo chmod -R 777 storage public
You have successfully installed the Africa CDC Knowledge Hub. Refer to the Developer Guide for instructions on maintaining and extending the platform.