nopCommerce Documentation

Installing on Linux

This chapter describes how to install the nopCommerce software on Linux system on the example of Xubuntu 22.04:

Install and configure software

.NET is available in the Ubuntu .NET backports package repository.

Add the .Net repository

Open a terminal and run the following commands:

sudo add-apt-repository ppa:dotnet/backports

nopCommerce installation

Install the .NET Core Runtime

Update the products available for installation, then install the .NET runtime:

sudo apt-get update

sudo apt-get install -y aspnetcore-runtime-10.0

Note

If you have an error, see the detailed information on the Install .NET SDK or .NET Runtime on Ubuntu page.

You can see all installed .Net Core runtimes by the following command:

dotnet --list-runtimes

Install MySql Server

Install the MySql server 8.0 version:

sudo apt-get install mysql-server-8.0

nopCommerce installation

By default, the root password is empty; let's set it. Run the following command to access the MySQL prompt:

sudo mysql

Run the following ALTER USER command to switch the root user’s authentication method to mysql_native_password, which uses a password. Replace ‘password’ with your desired new password, and make sure to keep the single quotes around the password:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Note

It’s important to choose a strong, unique password for your MySQL root user. A strong password should be at least 12 characters long, include a mix of uppercase and lowercase letters, numbers, and special characters.

Type exit and press Enter to exit the MySQL prompt.

nopCommerce installation

Note

If you have a problem with configuring root password on your MySql server, please read the following articles: How to Reset the Root Password and MySQL Error: 'Access denied for user 'root'@'localhost'.

Install nginx

Install the nginx package:

sudo apt-get install nginx

nopCommerce installation

Run the nginx service:

sudo systemctl start nginx

and check its status:

sudo systemctl status nginx

nopCommerce installation

To configure nginx as a reverse proxy to forward requests to your ASP.NET Core app, modify /etc/nginx/sites-available/default. Open it in a text editor and replace the contents with the following:

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name   nopCommerce.com;

    location / {
    proxy_pass         http://localhost:5000;
    proxy_http_version 1.1;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection keep-alive;
    proxy_set_header   Host $host;
    proxy_cache_bypass $http_upgrade;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Proto $scheme;
    }

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;
}

Get nopCommerce

Create a directory:

sudo mkdir /var/www/nopCommerce

Download and unpack nopCommerce:

cd /var/www/nopCommerce

sudo wget https://github.com/nopSolutions/nopCommerce/releases/download/release-5.00.1/nopCommerce_5.00.1_NoSource_linux_x64.zip

sudo apt-get install unzip

sudo unzip nopCommerce_5.00.1_NoSource_linux_x64.zip

Create couple directories to run nopCommerce:

sudo mkdir bin
sudo mkdir logs

Change the file permissions:

cd ..
sudo chgrp -R www-data nopCommerce/
sudo chown -R www-data nopCommerce/

Create the nopCommerce service

Create the /etc/systemd/system/nopCommerce.service file with the following contents:

[Unit]
Description=Example nopCommerce app running on Xubuntu

[Service]
WorkingDirectory=/var/www/nopCommerce
ExecStart=/usr/bin/dotnet /var/www/nopCommerce/Nop.Web.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=nopCommerce-example
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target

Start the service:

sudo systemctl start nopCommerce.service

Check the nopCommerce service status:

sudo systemctl status nopCommerce.service

nopCommerce installation

Restart the nginx server:

sudo systemctl restart nginx

Now that everything is ready, you can proceed to install and configure the store.

Installation process

The further installation process for nopCommerce is the same as the installation process on Windows; you can see the instruction following this link.

Troubleshooting

Gdip

If you have a problem with loading images in the RichText Box (The type initializer for 'Gdip' threw an exception), just install the libgdiplus library:

sudo apt-get install libgdiplus

SSL

If you want to use SSL on your site, don't forget to set the UseProxy setting to true in the appsettings.json file.

See also