How To Install OpenX on Ubuntu 24.04
If you’re looking to manage and optimize your ad serving, OpenX is one of the most reliable solutions available. With its user-friendly interface and robust feature set, OpenX (now known as Revive Adserver) is an excellent choice for websites looking to monetize their traffic effectively. In this blog post, we’ll guide you through the installation of OpenX on Ubuntu 24.04, ensuring that you can get your ad server up and running in no time.
Prerequisites
Before we begin the installation process, make sure you meet the following prerequisites:
- A server running Ubuntu 24.04: This tutorial assumes that you have root or sudo access.
- LAMP Stack: OpenX requires a web server (Apache), a Database Management System (MySQL/MariaDB), and PHP installed on your server.
- Access to terminal/SSH: You’ll be executing several commands in the terminal.
Step 1: Update Your System
First, make sure your system is fully up to date by running the following commands:
sudo apt update
sudo apt upgrade -y
Step 2: Install LAMP Stack
Install Apache, MySQL, and PHP with the following command:
sudo apt install apache2 mysql-server php php-mysql php-xml php-mbstring unzip -y
After the installation, make sure Apache and MySQL are running:
sudo systemctl start apache2
sudo systemctl start mysql
sudo systemctl enable apache2
sudo systemctl enable mysql
Step 3: Configure MySQL Database
Next, we need to create a database for OpenX. Log into the MySQL shell:
sudo mysql -u root -p
Once logged in, execute the following commands:
CREATE DATABASE openx;
CREATE USER 'openxuser'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON openx.* TO 'openxuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Make sure to replace 'your_secure_password'
with a strong password of your choice.
Step 4: Download and Install OpenX
Navigate to the Apache web directory:
cd /var/www/html
Next, download the latest version of OpenX (Revive Adserver) from the official website. As of the time this blog was written, the latest version could be downloaded with the following command:
wget https://www.revive-adserver.com/download/revive-adserver-x.x.x.zip
Replace x.x.x
with the current version number. Once downloaded, unzip the file:
unzip revive-adserver-x.x.x.zip
After unzipping, you may want to rename the directory for easier access:
mv revive-* openx
Step 5: Configure Permissions
To ensure that the web server can access the OpenX files, adjust the permissions:
sudo chown -R www-data:www-data /var/www/html/openx
sudo chmod -R 755 /var/www/html/openx
Step 6: Create Apache Configuration File
Now, create a new Apache configuration file for OpenX:
sudo nano /etc/apache2/sites-available/openx.conf
Add the following configuration, replacing your_domain.com
with your actual domain or IP address:
<VirtualHost *:80>
ServerAdmin admin@your_domain.com
DocumentRoot /var/www/html/openx
ServerName your_domain.com
ServerAlias www.your_domain.com
<Directory /var/www/html/openx>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/openx_error.log
CustomLog ${APACHE_LOG_DIR}/openx_access.log combined
</VirtualHost>
Save the file and enable the site:
sudo a2ensite openx.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Step 7: Complete OpenX Installation through the Web Interface
Open your web browser and visit your server’s domain or IP address:
http://your_domain.com
You should see the OpenX installation wizard. Follow the on-screen instructions and provide the database details (database name, username, password) you created earlier.
Step 8: Finalize Installation
After completing the setup, make sure to secure your installation by following the suggested steps to optimize your OpenX installation. You may want to create a backup plan and regularly update OpenX to keep your ad server secure.
Conclusion
Congratulations! You have successfully installed OpenX (Revive Adserver) on Ubuntu 24.04. You can now start managing your ad campaigns and generating revenue from your website.