See also:
NOTE: The nucleus-install.sh shell script automates many of the steps. This page describes the use of the shell script. This process has been tested with Ubuntu Server 24.04.
Set up your Linux environment. There are many options for setting up Linux, including:
nucleus-service
, installs the ASP.NET Core runtime, unzips the install set Nucleus, and then copies
the application settings template with settings for Linux, sets file system object ownership and permissions and configures systemd to
automatically start, monitor and restart Nucleus. The nucleus-service
user is used to run Nucleus, and does not have a password or a shell
configured, so you can't log in as this user.
For a fresh install you will not generally need to specify any command-line options.
-u, --createuser | Use --createuser false to prevent the nucleus-service user from being created. You should only use this option if the user has already been created. |
|
-d, --createdirectories | Use --createdirectories false to prevent creation of the /home/nucleus , /home/nucleus/app and /home/nucleus/data directories. This also prevents the commands which set the correct owner and permissions to directories. |
|
-z, --zipfile | Override auto-detection of the Nucleus install zip file name and specify the file to use. | |
-t, --target-directory | Override the default application path (/home/nucleus). If used in combination with --createuser true (the default), the specified directory will be assigned as the user's home directory. |
/home/services/nucleus-production
folder instead of using the default folder:
sudo bash ./nucleus-install.sh --zipfile Nucleus.2.0.0.0.Install.zip --target-directory /home/services/nucleus-production http://host-name:5000
http://ip-address:5000
Depending on your environment and objectives, you may need to configure a reverse proxy server. Refer to 'When to use Kestrel with a reverse proxy'
for more information.
You can set up Nginx, Kubernetes,
Apache or another reverse
proxy.
See also: Nginx Walkthrough
If you don't want to use a reverse proxy, you can use Nucleus with the default ports (http: 5000, https: 5001), or you can configure
Nucleus to run Kestrel using different ports (8080/8443) by editing /home/nucleus/appSettings.Production.json
.
sudo nano /home/nucleus/app/appSettings.Production.json
Locate the Kestrel section, and set the port for the Http endpoint and Https endpoints.
NOTE: Linux will not let you use port numbers less than 1024, because only the root user can use those ports. Use a reverse proxy if you want to use the conventional web server ports 80 and 443.
This command will create a self-signed certficate with no subject defined. A self-signed certificate is useful in a testing or development environment, but is not useful for a production environment, because your browser will display a security warning. When you browse to your site, you will have to ignore or disable security warnings, or "trust" the certificate in your browser, as it is not issued by a recognized certification authority.
sudo openssl req -nodes -new -keyout nucleus.key -x509 -days 365 -out nucleus.crt -subj "/"
sudo cp nucleus.crt /home/nucleus/certs
sudo cp nucleus.key /home/nucleus/certs
sudo chown :nucleus-service /home/nucleus/certs/nucleus.key /home/nucleus/certs/nucleus.crt
sudo chmod g+rw /home/nucleus/certs/nucleus.key /home/nucleus/certs/nucleus.crt
If you are using a reverse proxy, you will generally want to configure the reverse proxy to use your certificate and manage ("terminate") SSL connections, so you won't need to configure Nucleus for https, and can skip this section.
If you will be running Nucleus without a reverse proxy, configure https and certificate settings with:
sudo nano /home/nucleus/app/appSettings.Production.json
Add or un-comment the following setting in Kestrel:Endpoints section. In the default Linux settings template, the section is already present (commented out), so you can just un-comment the section and fill in the password:
"HttpsInlineCertAndKeyFile": {
"Url": "https://*:5001", // or "https://your-hostname:5001" if you want to specify a host name
"Certificate": {
"Path": "/home/nucleus/certs/nucleus.crt",
"KeyPath": "/home/nucleus/certs/nucleus.key"
}
}
Follow the steps in this section if you want to install and configure Nginx as a reverse proxy.
Install:
sudo apt install nginx
Create configuration file:
sudo nano /etc/nginx/sites-enabled/nucleus
Insert these settings. If you have not created a certificate, omit or comment out the two listen
commands which refer to port 443, and the two
ssl_certificate
lines:
server {
listen 80;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /home/nucleus/certs/nucleus.crt;
ssl_certificate_key /home/nucleus/certs/nucleus.key;
server_name _;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_connect_timeout 30s;
proxy_timeout 30s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header "Connection" "";
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;
}
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
}
To comment out a line, add # to the start of the line.
Remove the default configuration file:
sudo rm /etc/nginx/sites-enabled/default
Restart nginx:
sudo systemctl restart nginx
At this point, Nginx is configured to listen on port 80 (and/or 443 if you have created a certificate), and will communicate with Nucleus on the local machine/port 5000.
Allow SSH connections:
sudo ufw allow "OpenSSH"
Allow http and https connections:
Allow FTP:
sudo ufw allow 22
Enable firewall on next boot:
sudo ufw enable
Review settings:
sudo ufw status
Restart to enable the firewall:
sudo shutdown -r now
If you are not able to access Nucleus using your browser, you can try the following steps.
nucleus-service
user and try running Nucleus interactively. Log messages will be displayed on-screen.