Deploy the ASP. Net core System to the SuSE Linux Enterprise Server SP2 64 Specific scenarios __linux

Source: Internet
Author: User
Tags chmod dotnet mkdir ssh
deployment of ASP. Net Core Systems to SuSE Linux Enterprise Server SP2 64 Specific scenarios steps for. Net Core deployment to SUSE Linux Enterprise Server SP2 64-bit

1. Installation Tools

1, Apache

2. Net Core (dotnet-sdk-2.0)

3, Supervisor (Process management tools, the purpose is to boot on the server on the server launched on the asp.net Core Web site)

2. Install Apache

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

sudo zypper in Apache

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

Buntun sudo apt-get install apache2)

(Note: View Apache version sudo apachectl-v)

Installation complete, start boot up

Restart the Apache service (set two, 1 is available, 2 is started)

Available: sudo systemctl enable Apache2.service

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

Buntun sudo/etc/init.d/apache2 Restart)

Start: sudo systemctl start apache2.service

In the browser to enter http://localhost or http://127.0.0.1, if you see it works!, it means that the successful installation of Apache, Apache's default document root directory is on the SuSE/srv/www/ htdocs/directory, if the 403 page denied access error, because there is no index.html caused, add a index.html file, add index.html file, refresh the browser, display add content OK.

Note: You need permission to add files, so pass

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

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

Configure the/ETC/APACHE2/CONF.D/directory that is stored in.

3, installation. NET Core 2.0

1, Registered Linux system (Ubuntu and Debian based systems, 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, installation. NET Core

sudo zypper update

sudo zypper install Libunwind Libicu

sudo zypper install dotnet-sdk-2.1.4

Note The solution selection appears during the installation process, select 2.

Note: The above registration and installation can refer to

Https://www.microsoft.com/net/learn/get-started/linux/opensuse

4, check the dotnet--version result is 2.1.4 the installation is successful.

(Note: A simple Application project folder, use the following command to start the Web site, as long as the file open the publishing site, the right to open the terminal dotnet Run or dotnet Xx.dll, can be shipped, XX for the name of the site)

sudo dotnet Xxx.dll

You can then open localhost:5000 in the browser (5000 is the default port, and if so, use the actual IP and port access (the MMPs port is set to 8080))

Note: If the extranet cannot access port 8080, set the following

1, sudo chmod a+w/etc/sysconfig/susefirewall2 #授编辑权限

2, vi SuSEfirewall2 or directly open SuSEfirewall2 file for editing

3, edit content: found in the file SuSEfirewall2 fw_services_ext_tcp, followed by a service name or service corresponding to the port, such as SSH,
fw_services_ext_tcp= "ssh" or fw_services_ext_tcp= "22″ or fw_services_ext_tcp=" 8080″, or fw_services_ext_tcp= if you want to open multiple ports "8080 89″ #多个端口用空格分开, save and exit.

4, reboot the firewall, so that the configuration is effective,
sudo rcSuEfirewall2 restart

To this location is basically achieved through IP access, however, each shutdown, restart all need to manually launch the release of the website project to access, so we use Supervisor managed to start the Web site service operation, to ensure that every time as long as a boot, the site can be normal.
3, install Supervisor (set up automatically set up the website)

1, right key in the terminal open, enter the installation command:

Install Python

sudo zypper in Python-pip

sudo pip install-u setuptools

Pip Install Supervisor

2, after the installation is completed, create the relevant documents,

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 to the corresponding/var/run or/var/log

(with sudo chmod a+w etc/supervisor/supervisord.conf can be opened for editing,/tmp replaced by the corresponding/var/run or/var/log Replace, save)

2, the supervisord.conf in the

; At the [include] node

; files = Relative/directory/*.ini

Into

[include]

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

3, 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 Write the following command (if you do not have permission,

Please use the following methods

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

The contents of the command are as follows:

[Program:mmpscore]

Command=dotnet MmPSCore.dll #要执行的命令 (Publish Web site execution file)

The directory that the directory=/home/xx/mmpscore# command executes (publish Web site file path) environment=aspnetcore__environment=production #环境变量

User=www-data #进程执行的用户身份 (may need to be removed)

Stopsignal=int

Autostart=true #是否自动启动

Autorestart=true #是否自动重启

Startsecs=1 #自动重启间隔

User=root; #进程执行的用户身份 (Can not write)

Stderr_logfile=/var/log/testcore.err.log #标准错误日志

Stdout_logfile=/var/log/testcore.out.log #标准输出日志

Note: #后面的内容为注释, when saving the above file code, remember to delete

After the operation is finished, save,

Run Supervisord to see if it takes effect and 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 that the operation was successful.

If there are errors, it is recommended that the following command be executed

This two-sentence order is important.

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

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

4. Configure Supervisord startup to create files 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 content:

[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 starts:

Systemctl is-enabled Supervisord

Tips:

Enabled

Indicates that the setting was successful.

At this point, the Create Supervisor daemon is complete.

5, testing

Next reboot the machine, enter the IP address in the browser, and see if the website will follow the boot autorun.

Related Article

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.