How to Install Trac on Debian Latest
Trac is an open-source project management and bug tracking tool, often used for software development projects. In this tutorial, we will guide you through the steps on how to install Trac on the latest Debian version.
Prerequisites
Before installing Trac, you should have:
- A Debian operating system up-to-date with root permissions
- Access to an Internet connection
- Python 2.7 or 3.x
- SQLite, MySQL, or PostgreSQL database
Step 1: Install required dependencies
- Update and upgrade the package list
sudo apt update && sudo apt upgrade -y
- Install the necessary dependencies
sudo apt install python-setuptools python-pysqlite2 python-genshi python-lxml
- If you're using MySQL, install the Python/MySQL connector.
sudo apt install python-mysqldb
- If you're using PostgreSQL, install the Python/PostgreSQL connector.
sudo apt install python-psycopg2
Step 2: Install Trac
- Download the latest stable version of Trac from the official website using the following command:
wget https://trac.edgewall.org/wiki/TracDownload#LatestStableRelease
- Unzip the file
unzip Trac-x.x.x.zip
- Move the extracted folder to the /usr/share directory
sudo mv Trac-x.x.x /usr/share/trac
- Create a symbolic link to the /usr/bin directory
sudo ln -s /usr/share/trac/trac-admin /usr/bin/trac-admin
Step 3 Configure Your Database
Trac supports various databases, including SQLite, MySQL, and PostgreSQL.
SQLite
- Create a new SQLite database
sudo mkdir -p /var/trac
sudo sqlite3 /var/trac/trac.db
- Press
[Ctrl] + [D]to exit.
MySQL
- Create a new MySQL database
mysql -u root -p
CREATE DATABASE tracdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'trac'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL PRIVILEGES ON tracdb.* to 'trac'@'localhost';
FLUSH PRIVILEGES;
exit
PostgreSQL
- Create a new PostgreSQL database
sudo -u postgres psql
CREATE USER trac WITH PASSWORD 'your_password_here';
CREATE DATABASE tracdb OWNER trac ENCODING 'UTF8';
\q
Step 4 Create a new Trac project
- Run the following command to set up a new Trac project
sudo trac-admin /path/to/your/new/trac/project initenv
- Provide project information when prompted
- Configure your database connection
SQLite
Database connection string [sqlite:db/trac.db]:
MySQL
Database connection string [mysql://user:password@host/dbname]:
PostgreSQL
Database connection string [postgres://user:password@host/dbname]:
- Start Trac's development server
sudo tracd --port 8000 /path/to/your/new/trac/project
- Open your web browser to
http://localhost:8000or your server's IP address and you'll see your new Trac project.
Conclusion
You have successfully installed and configured Trac on your Debian system, started a new project, and configured a database connection.