mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
75 lines
1.6 KiB
Bash
75 lines
1.6 KiB
Bash
#!/bin/bash
|
|
echo "Thanks for trying Remotely!"
|
|
echo
|
|
|
|
AppRoot=$(dirname $(readlink -f $0))
|
|
HostName=""
|
|
|
|
yum update
|
|
|
|
# Install .NET Core Runtime.
|
|
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
|
|
|
|
yum -y install apt-transport-https
|
|
yum -y update
|
|
yum -y install aspnetcore-runtime-5.0
|
|
|
|
|
|
# Install other prerequisites.
|
|
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
|
yum -y install yum-utils
|
|
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
|
|
yum -y install unzip
|
|
yum -y install acl
|
|
yum -y install libc6-dev
|
|
yum -y install libgdiplus
|
|
|
|
|
|
# Install Caddy
|
|
yum install yum-plugin-copr
|
|
yum copr enable @caddy/caddy
|
|
yum install caddy
|
|
|
|
|
|
# Configure Caddy
|
|
caddyConfig="
|
|
$HostName {
|
|
reverse_proxy 127.0.0.1:5000
|
|
}
|
|
"
|
|
|
|
echo "$caddyConfig" > /etc/caddy/Caddyfile
|
|
|
|
|
|
# Create service.
|
|
|
|
serviceConfig="[Unit]
|
|
Description=Remotely Server
|
|
|
|
[Service]
|
|
WorkingDirectory=$AppRoot
|
|
ExecStart=/usr/bin/dotnet $AppRoot/Remotely_Server.dll
|
|
Restart=always
|
|
# Restart service after 10 seconds if the dotnet service crashes:
|
|
RestartSec=10
|
|
SyslogIdentifier=remotely
|
|
Environment=ASPNETCORE_ENVIRONMENT=Production
|
|
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target"
|
|
|
|
echo "$serviceConfig" > /etc/systemd/system/remotely.service
|
|
|
|
|
|
# Enable service.
|
|
systemctl enable remotely.service
|
|
# Start service.
|
|
systemctl start remotely.service
|
|
|
|
firewall-cmd --permanent --zone=public --add-service=http
|
|
firewall-cmd --permanent --zone=public --add-service=https
|
|
firewall-cmd --reload
|
|
|
|
# Restart caddy
|
|
systemctl restart caddy |