Lab Setup
- We will have two linux servers setup according to the image below
Steps for configuring database server:
- Create an ubuntu 20.04 instance and ssh into it
- Note for Azure: If the source setup is done in azure we can directly create a user called as qtadmin while creating the vm
- update ubuntu packages and create a user called as qtadmin
sudo apt update
sudo adduser qtadmin
- Check if the password authentication is enabled if not enable it
sudo vi /etc/ssh/sshd_config
# change PasswordAuthentication from no to yes
- Now lets give admin permissions to qtadmin and swith to qtadmin
sudo usermod -aG sudo qtadmin
su qtadmin
sudo apt update
* Now mysql installation Refer Here
sudo apt update
sudo apt install mysql-server -y
sudo systemctl start mysql.service
- Verify mysql installation
sudo mysql
- By default mysql service runs on localhost now we need to change the configuration to use private ip address. Open the file
/etc/mysql/mysql.conf.d/mysqld.cnf - Change the bind-address and mysqlx-bind-address from 127.0.0.1 to 0.0.0.0
- Now reload the daemon and restart the mysql
sudo systemctl daemon-reload
sudo systemctl restart mysql.service
- Now we need to create a user in mysql with permissions on all databases
CREATE USER 'nop'@'%' IDENTIFIED BY 'nop12345';
GRANT ALL PRIVILEGES ON *.* TO 'nop'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Setup nopCommerce
- If your setup is in AWS, We need to create a user called as qtadmin with sudo permissions
- Create an ubuntu 20.04 instance and ssh into it
- update ubuntu packages and create a user called as qtadmin
sudo apt update
sudo adduser qtadmin
- Check if the password authentication is enabled if not enable it
sudo vi /etc/ssh/sshd_config
# change PasswordAuthentication from no to yes
- Now lets give admin permissions to qtadmin and swith to qtadmin
sudo usermod -aG sudo qtadmin
su qtadmin
sudo apt update
* Note for Azure: If the source setup is done in azure we can directly create a user called as qtadmin while creating the vm
* Install dotnet 7 and nopCommerce from the steps below and also Refer Here
cd /tmp
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https aspnetcore-runtime-7.0
dotnet --list-runtimes
sudo apt install unzip -y
sudo mkdir /var/nopCommerce
cd /var/nopCommerce
sudo wget https://github.com/nopSolutions/nopCommerce/releases/download/release-4.60.4/nopCommerce_4.60.4_NoSource_linux_x64.zip
sudo unzip nopCommerce_4.60.4_NoSource_linux_x64.zip
sudo mkdir bin logs
- Now try running nopCommerce
sudo dotnet Nop.Web.dll --urls "http://0.0.0.0:5000"
- Now access the application
- Lets configure this application to run as a service
- Lets create a user called as nop
sudo useradd nop
- Grant full permissions to the folder
/var/nopCommerceto nop user
sudo chgrp -R nop /var/nopCommerce
sudo chown -R nop /var/nopCommerce
- Now create a service called as nopCommerce by creating a file
/etc/systemd/system/nopCommerce.servicewith following content
[Unit]
Description=Example nopCommerce app running on Xubuntu
[Service]
WorkingDirectory=/var/nopCommerce
ExecStart=/usr/bin/dotnet /var/nopCommerce/Nop.Web.dll --urls "http://0.0.0.0:5000"
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=nopCommerce-example
User=nop
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
- Now enable and start the service
sudo systemctl enable nopCommerce.service
sudo systemctl start nopCommerce.service
sudo systemctl status nopCommerce.service
- Now navigate to the application
http://<ip>:5000and finish the installation.
