ASP. Net core Systems deployed to SuSE Linux Enterprise Server SP3 64 specific scenarios

Source: Internet
Author: User
Tags dotnet

. Net Core deployment to SUSE   steps in Linux Enterprise Server-SP3

1. Installation Tools

1.Apache

2.. Net Core (dotnet-sdk-2.0)

3,Supervisor ( Process Management tool , the purpose is to start the server on the launch of the ASP. Net Core Web site published on the server)

2. Installing Apache

To install Apache, enter the command in the command line terminal:

sudo zypper in Apache

(Note that this is not the same as adding in Ubuntun,

Buntun in sudo apt-get install apache2 )

(Note: View the Apache version of sudo apachectl-v)

Installation complete, start start

restart Apache Service (set two items,1 is available,2 is boot)

Available :sudo systemctl enable Apache2.service

(Note that this is not the same as adding in Ubuntun,

Buntun in sudo/etc/init.d/apache2 restart )

Start :sudo systemctl start apache2.service

Enter http://localhost or http://127.0.0.1in the browser, if you see it works! , it means Apache The installation was successful, Apache the default document root directory is the SUSE on the /srv/www/htdocs/ directory, if it appears 403 page denied access error because there is no index.html cause, add a index.html files can be, the content is as follows

<body>

It works!

</body>

After adding the index.html file, refresh the browser again to display the Add content OK.

Note: Permissions are required to add files, so the

command sudo chmod a+w/srv/www/htdocs/ authorization, so you can add index.html initial page,

Note: The configuration file is /etc/apache2/httpd.conf.

Configure the /etc/apache2/conf.d/directories stored in .

3.install . NET Core 2.0

1, registered Linux system (Ubuntu and Debian basedsystems, different system operation is not the same )

sudo rpm--import https://packages.microsoft.com/keys/microsoft.asc

sudo sh-c ' echo-e ' [Packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https:// packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https:// Packages.microsoft.com/keys/microsoft.asc ">/etc/zypp/repos.d/dotnetdev.repo"

2.Update the installation package, install the . NET Core

sudo zypper update

sudo zypper install Libunwind Libicu

sudo zypper install dotnet-sdk-2.1.4

Note the solution selection appears during installation, select 2 .

4.Check dotnet--version The result is 2.1.4 the installation is successful.

(Note: The Simple Application project folder, start the Web site with the following command, as long as open the publishing site files, right-click Terminal Open dotnet run or dotnet xx.dll, can be shipped, xx is the name of the site)

sudo dotnet Xxx.dll

then you can open the localhost:5000 in the browser ( the default port, if there are modifications, use the actual IP and port access (mmps Port set is 8080))

Note: If the external network cannot access the 8080 port, set the following

1.sudo chmod a+w/etc/sysconfig/susefirewall2 # Grant Edit Permission

2,VI SuSEfirewall2 or directly open the SuSEfirewall2 file for editing

3. Edit content: find fw_services_ext_tcp in file SuSEfirewall2, followed by service name or port of service, such as SSH ,
fw_services_ext_tcp= "ssh" or fw_services_ext_tcp= "22″ or fw_services_ext_tcp=" 8080″, If you want to open more than one port , fw_services_ext_tcp= "8080 89″# multiple ports are separated by spaces , and then exit after saving.

4. Restart the firewall for theconfiguration to take effect.
sudo rcSuSEfirewall2 restart

To this location is basically achieved through IP access , but after each shutdown, the reboot will need to manually start publishing the site project to access, so we use the Supervisor managed Autostart Web service operation, Ensure that the site can be normal every time you start a boot.

3. installation Supervisor (Set power on auto settings website)

1. Right-click in the terminal to open, enter the installation command :

Install Python

sudo zypper in Python-pip

sudo pip install-u setuptools

Pip Install Supervisor

(Note: If the above method cannot be installed, you can install it using the following method (refer to link: http://www.cnblogs.com/1175429393wljblog/p/9044994.html)

1.1 Pip Download

wget "HTTPS://PYPI.PYTHON.ORG/PACKAGES/SOURCE/P/PIP/PIP-1.5.4.TAR.GZ#MD5=834B2904F92D46AAA333267FB1C922BB"-- No-check-certificate

1.2 Pip Installation

TAR-XZVF pip-1.5.4.tar.gz

CD pip-1.5.4

Python setup.py Install

1.3 pip installation software

Pip Install Supervisor

2. after the installation is complete , create the relevant files

First Kind

To create a supervisor configuration file directory

sudo mkdir/etc/supervisor

Creating a master configuration file

Echo_supervisord_conf >/etc/supervisor/supervisord.conf

If you are prompted for insufficient permissions,

Su Root

Echo_supervisord_conf >/etc/supervisor/supervisord.conf

Create a Project Profile directory CONF.D

cd/etc/supervisor/

sudo mkdir conf.d

Create a project configuration file under File directory CONF.D (Start-up web site)

sudo vim conf.d/mmpscore.conf (after editing is complete, press ESC, press: Colon, and then enter wq!). , which can be exited)

The second Kind

echo_supervisord_conf > supervisord.conf

sudo mkdir/etc/supervisor

sudo mkdir/etc/supervisor/conf.d

sudo cp supervisord.conf/etc/supervisor/supervisord.conf

Note:1./tmp in supervisord.conf is replaced by the corresponding /var/run or /var/log

( using sudo chmod a+w etc/supervisor/supervisord.conf can be opened for editing,/tmp for the corresponding /var/run or /var/log after replacement, save )

2, the supervisord.conf in the

; [include] node at

; files = Relative/directory/*.ini

Into

[include]

Files =/etc/supervisor/conf.d/*.conf

3, the configuration file, named mmpscore.conf ( the name of the current project )

sudo touch/etc/supervisor/conf.d/mmpscore.conf (custom project name, this item is mmpscore.conf)

Open Mmpscore.conf writes the following command ( If there is no permission,

Please use the following method

sudo chmod a+w/etc/supervisor/conf.d/mmpscore.conf (Command start Edit)

The command contents are as follows:

[Program:mmpscore]

Command=dotnet MmPSCore.dll # command to execute (Publish Web site execution file)

directory=/home/xx/mmpscore# Command Execution directory (publish Web site file path) environment=aspnetcore__environment=production # environment variable

User=www-data # user identity of the process execution (may need to be removed)

Stopsignal=int

Autostart=true # whether to start automatically

Autorestart=true # Whether to restart automatically

Startsecs=1 # Automatic restart interval

User=root; # The user identity of the process execution (can not be written)

Stderr_logfile=/var/log/testcore.err.log # standard error log (TestCore.err.log This file is not, need to be created manually)

Stdout_logfile=/var/log/testcore.out.log # Standard output log (TestCore.out.log This file is not, need to be created manually)

Note:# After the content is a comment, when saving the above file code , remember to delete

After the above operation is done, save,

run Supervisordto see if it takes effect, execute the following command:

Supervisord-c/etc/supervisor/supervisord.conf

Ps-ef | grep ProjectName

Return

Root 27007 27006 1 13:21? 00:00:02 dotnet ProjectName.dll

Root 27026 26810 0 13:23 pts/0 00:00:00 grep--color=auto ProjectName

Indicates a successful run!

If there is an error, it is recommended to execute the following command

This two-sentence order is important.

sudo supervisord-c/etc/supervisor/supervisord.conf

sudo supervisorctl-c/etc/supervisor/supervisord.conf

4. Configure Supervisord Boot

    1. create a file under the specified directory supervisord.service

sudo touch/usr/lib/systemd/system/supervisord.service

sudo chmod a+w usr/lib/systemd/system/supervisord.service

B. Enter the following:

[Unit]

Description=supervisor Daemon

[Service]

Type=forking

Execstart=/usr/bin/supervisord-c/etc/supervisor/supervisord.conf

Execstop=/usr/bin/supervisorctl shutdown

Execreload=/usr/bin/supervisorctl Reload

Killmode=process

Restart=on-failure

Restartsec=42s

[Install]

Wantedby=multi-user.target

Save and exit

C. execute the following command:

Systemctl Enable Supervisord

Tips:

Created symlink From/etc/systemd/system/multi-user.target.wants/supervisord.service to/usr/lib/systemd/system/ Supervisord.service.

D. Verify that the boot is on:

Systemctl is-enabled Supervisord

Tips:

Enabled

Indicates a successful setup!

This completes the creation of the Supervisor Daemon.

5. Testing

then restart the machine, enter in the browser IP Address to see if the website follows the boot automatically .

ASP. Net core Systems deployed to SuSE Linux Enterprise Server SP3 64 specific scenarios

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.