Inventree is an open-source inventory management system that you can install on your Ubuntu Server to keep track of your inventory. This tutorial will guide you through the steps to install Inventree on Ubuntu Server.
Before installing Inventree, you should have the following:
Before you can install Inventree on your Ubuntu Server, you need to install its dependencies. You can do this using the following command:
sudo apt-get update
sudo apt-get install python3 python3-pip python3-dev libpq-dev nginx curl
Virtualenv is a tool that creates isolated Python environments. You can use it to install Inventree and its dependencies in a separate environment. You can install it using the following command:
sudo pip3 install virtualenv
Now that you have installed virtualenv, navigate to the directory where you want to install Inventree and create a virtual environment using the following command:
cd /opt
sudo mkdir inventree
sudo chown -R $USER:$USER inventree
cd inventree
virtualenv env
source env/bin/activate
This will create a new virtual environment and activate it.
Now that you have created a virtual environment, install Inventree using the following command:
pip3 install inventree
Inventree comes with a default configuration file, which you can modify to suit your needs. To create a configuration file, navigate to the virtual environment's bin directory using the following command:
cd env/bin
Now, create a new file called inventree_config.py
using the following command:
sudo nano inventree_config.py
This will open the Nano text editor. You can add your configuration options to this file. Here is an example configuration:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'inventree',
'USER': 'inventreeuser',
'PASSWORD': 'inventreepassword',
'HOST': 'localhost',
'PORT': '5432',
}
}
This configuration tells Inventree to use PostgreSQL as its database backend, and the database name is inventree
. You may also need to modify the database username and password to suit your needs. Save and exit the file.
Now that you have configured Inventree, you can migrate the database using the following command:
cd /opt/inventree
python3 manage.py migrate
Now, create a superuser using the following command:
python3 manage.py createsuperuser
This will create a new user that you can use to log in to Inventree.
Inventree comes with a sample Nginx configuration file. You can use this as a starting point for your own configuration. Navigate to the Nginx configuration directory using the following command:
cd /etc/nginx/sites-available
Now, create a new configuration file using the following command:
sudo nano inventree
This will open the Nano text editor. Add the following configuration:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /static/ {
alias /opt/inventree/staticfiles/;
}
}
Make sure to replace your-domain.com
with your actual domain name. Save and exit the file.
Now, create a symbolic link from the sites-available
directory to the sites-enabled
directory using the following command:
sudo ln -s /etc/nginx/sites-available/inventree /etc/nginx/sites-enabled/
Finally, restart Nginx using the following command:
sudo systemctl restart nginx
Now that you have installed and configured Inventree, you can run it using the following command:
cd /opt/inventree
source env/bin/activate
python3 manage.py runserver
You can now access Inventree by visiting http://your-domain.com
in your web browser.
Inventree is a powerful open-source inventory management system that you can install on your Ubuntu Server to keep track of your inventory. By following this tutorial, you should now have Inventree installed and running on your Ubuntu Server.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!