nginxproxymanager-v5.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. #!/usr/bin/env bash
  2. function header_info {
  3. cat <<"EOF"
  4. _ __ _ ____ __ ___
  5. / | / /___ _(_)___ _ __ / __ \_________ _ ____ __ / |/ /___ _____ ____ _____ ____ _____
  6. / |/ / __ / / __ \| |/_/ / /_/ / ___/ __ \| |/_/ / / / / /|_/ / __ / __ \/ __ / __ / _ \/ ___/
  7. / /| / /_/ / / / / /> < / ____/ / / /_/ /> </ /_/ / / / / / /_/ / / / / /_/ / /_/ / __/ /
  8. /_/ |_/\__, /_/_/ /_/_/|_| /_/ /_/ \____/_/|_|\__, / /_/ /_/\__,_/_/ /_/\__,_/\__, /\___/_/
  9. /____/ v5 /____/ /____/
  10. EOF
  11. }
  12. clear
  13. header_info
  14. echo -e "Loading..."
  15. APP="Nginx Proxy Manager"
  16. var_disk="4"
  17. var_cpu="1"
  18. var_ram="1024"
  19. var_os="debian"
  20. var_version="11"
  21. NSAPP=$(echo ${APP,,} | tr -d ' ')
  22. var_install="${NSAPP}-v5-install"
  23. INTEGER='^[0-9]+$'
  24. YW=$(echo "\033[33m")
  25. BL=$(echo "\033[36m")
  26. RD=$(echo "\033[01;31m")
  27. BGN=$(echo "\033[4;92m")
  28. GN=$(echo "\033[1;92m")
  29. DGN=$(echo "\033[32m")
  30. CL=$(echo "\033[m")
  31. BFR="\\r\\033[K"
  32. HOLD="-"
  33. CM="${GN}✓${CL}"
  34. CROSS="${RD}✗${CL}"
  35. set -o errexit
  36. set -o errtrace
  37. set -o nounset
  38. set -o pipefail
  39. shopt -s expand_aliases
  40. alias die='EXIT=$? LINE=$LINENO error_exit'
  41. trap die ERR
  42. function error_exit() {
  43. trap - ERR
  44. local reason="Unknown failure occurred."
  45. local msg="${1:-$reason}"
  46. local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
  47. echo -e "$flag $msg" 1>&2
  48. exit $EXIT
  49. }
  50. function msg_info() {
  51. local msg="$1"
  52. echo -ne " ${HOLD} ${YW}${msg}..."
  53. }
  54. function msg_ok() {
  55. local msg="$1"
  56. echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
  57. }
  58. function msg_error() {
  59. local msg="$1"
  60. echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
  61. }
  62. function PVE_CHECK() {
  63. PVE=$(pveversion | grep "pve-manager/7" | wc -l)
  64. if [[ $PVE != 1 ]]; then
  65. echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
  66. echo -e "Exiting..."
  67. sleep 2
  68. exit
  69. fi
  70. }
  71. if command -v pveversion >/dev/null 2>&1; then
  72. if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
  73. NEXTID=$(pvesh get /cluster/nextid)
  74. else
  75. clear
  76. echo -e "⚠ User exited script \n"
  77. exit
  78. fi
  79. fi
  80. if ! command -v pveversion >/dev/null 2>&1; then
  81. if [[ ! -f /lib/systemd/system/npm.service ]]; then
  82. msg_error "No ${APP} Installation Found!";
  83. exit
  84. fi
  85. if (whiptail --title "${APP} LXC UPDATE" --yesno "This will update ${APP} LXC. Proceed?" 10 58); then
  86. echo "User selected Update"
  87. else
  88. clear
  89. echo -e "⚠ User exited script \n"
  90. exit
  91. fi
  92. fi
  93. function default_settings() {
  94. echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
  95. CT_TYPE="1"
  96. echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
  97. PW=""
  98. echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
  99. CT_ID=$NEXTID
  100. echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
  101. HN=$NSAPP
  102. echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
  103. DISK_SIZE="$var_disk"
  104. echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
  105. CORE_COUNT="$var_cpu"
  106. echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
  107. RAM_SIZE="$var_ram"
  108. echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
  109. BRG="vmbr0"
  110. echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
  111. NET=dhcp
  112. echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
  113. GATE=""
  114. echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}"
  115. MTU=""
  116. echo -e "${DGN}Using DNS Search Domain: ${BGN}Host${CL}"
  117. SD=""
  118. echo -e "${DGN}Using DNS Server Address: ${BGN}Host${CL}"
  119. NS=""
  120. echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
  121. MAC=""
  122. echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
  123. VLAN=""
  124. echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}"
  125. SSH="no"
  126. echo -e "${DGN}Enable Verbose Mode: ${BGN}No${CL}"
  127. VERB="no"
  128. VERB2="silent"
  129. echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
  130. }
  131. function advanced_settings() {
  132. CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 10 58 2 \
  133. "1" "Unprivileged" ON \
  134. "0" "Privileged" OFF \
  135. 3>&1 1>&2 2>&3)
  136. exitstatus=$?
  137. if [ $exitstatus = 0 ]; then
  138. echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
  139. fi
  140. PW1=$(whiptail --inputbox "Set Root Password (needed for root ssh access)" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  141. exitstatus=$?
  142. if [ $exitstatus = 0 ]; then
  143. if [ -z $PW1 ]; then
  144. PW1="Automatic Login" PW=" "
  145. echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
  146. else
  147. PW="-password $PW1"
  148. echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
  149. fi
  150. fi
  151. CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  152. exitstatus=$?
  153. if [ -z $CT_ID ]; then
  154. CT_ID="$NEXTID"
  155. echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
  156. else
  157. if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
  158. fi
  159. CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  160. exitstatus=$?
  161. if [ -z $CT_NAME ]; then
  162. HN="$NSAPP"
  163. echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
  164. else
  165. if [ $exitstatus = 0 ]; then
  166. HN=$(echo ${CT_NAME,,} | tr -d ' ')
  167. echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
  168. fi
  169. fi
  170. DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  171. exitstatus=$?
  172. if [ -z $DISK_SIZE ]; then
  173. DISK_SIZE="$var_disk"
  174. echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
  175. else
  176. if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
  177. if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
  178. echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
  179. advanced_settings
  180. fi
  181. fi
  182. CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  183. exitstatus=$?
  184. if [ -z $CORE_COUNT ]; then
  185. CORE_COUNT="$var_cpu"
  186. echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
  187. else
  188. if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
  189. fi
  190. RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  191. exitstatus=$?
  192. if [ -z $RAM_SIZE ]; then
  193. RAM_SIZE="$var_ram"
  194. echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
  195. else
  196. if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
  197. fi
  198. BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  199. exitstatus=$?
  200. if [ -z $BRG ]; then
  201. BRG="vmbr0"
  202. echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
  203. else
  204. if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
  205. fi
  206. NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  207. exitstatus=$?
  208. if [ -z $NET ]; then
  209. NET="dhcp"
  210. echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
  211. else
  212. if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
  213. fi
  214. GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  215. exitstatus=$?
  216. if [ $exitstatus = 0 ]; then
  217. if [ -z $GATE1 ]; then
  218. GATE1="Default" GATE=""
  219. echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
  220. else
  221. GATE=",gw=$GATE1"
  222. echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
  223. fi
  224. fi
  225. MTU1=$(whiptail --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  226. exitstatus=$?
  227. if [ $exitstatus = 0 ]; then
  228. if [ -z $MTU1 ]; then
  229. MTU1="Default" MTU=""
  230. echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}"
  231. else
  232. MTU=",mtu=$MTU1"
  233. echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}"
  234. fi
  235. fi
  236. SD=$(whiptail --inputbox "Set a DNS Search Domain (leave blank for HOST)" 8 58 --title "DNS Search Domain" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  237. exitstatus=$?
  238. if [ $exitstatus = 0 ]; then
  239. if [ -z $SD ]; then
  240. SD=""
  241. echo -e "${DGN}Using DNS Search Domain: ${BGN}Host${CL}"
  242. else
  243. SX=$SD
  244. SD="-searchdomain=$SD"
  245. echo -e "${DGN}Using DNS Search Domain: ${BGN}$SX${CL}"
  246. fi
  247. fi
  248. NS=$(whiptail --inputbox "Set a DNS Server IP (leave blank for HOST)" 8 58 --title "DNS SERVER IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  249. exitstatus=$?
  250. if [ $exitstatus = 0 ]; then
  251. if [ -z $NS ]; then
  252. NS=""
  253. echo -e "${DGN}Using DNS Server IP Address: ${BGN}Host${CL}"
  254. else
  255. NX=$NS
  256. NS="-nameserver=$NS"
  257. echo -e "${DGN}Using DNS Server IP Address: ${BGN}$NX${CL}"
  258. fi
  259. fi
  260. MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  261. exitstatus=$?
  262. if [ $exitstatus = 0 ]; then
  263. if [ -z $MAC1 ]; then
  264. MAC1="Default" MAC=""
  265. echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
  266. else
  267. MAC=",hwaddr=$MAC1"
  268. echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
  269. fi
  270. fi
  271. VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
  272. exitstatus=$?
  273. if [ $exitstatus = 0 ]; then
  274. if [ -z $VLAN1 ]; then
  275. VLAN1="Default" VLAN=""
  276. echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
  277. else
  278. VLAN=",tag=$VLAN1"
  279. echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
  280. fi
  281. fi
  282. if (whiptail --defaultno --title "SSH ACCESS" --yesno "Enable Root SSH Access?" 10 58); then
  283. echo -e "${DGN}Enable Root SSH Access: ${BGN}Yes${CL}"
  284. SSH="yes"
  285. else
  286. echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}"
  287. SSH="no"
  288. fi
  289. if (whiptail --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then
  290. echo -e "${DGN}Enable Verbose Mode: ${BGN}Yes${CL}"
  291. VERB="yes"
  292. VERB2=""
  293. else
  294. echo -e "${DGN}Enable Verbose Mode: ${BGN}No${CL}"
  295. VERB="no"
  296. VERB2="silent"
  297. fi
  298. if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
  299. echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
  300. else
  301. clear
  302. header_info
  303. echo -e "${RD}Using Advanced Settings${CL}"
  304. advanced_settings
  305. fi
  306. }
  307. function install_script() {
  308. if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
  309. header_info
  310. echo -e "${BL}Using Default Settings${CL}"
  311. default_settings
  312. else
  313. header_info
  314. echo -e "${RD}Using Advanced Settings${CL}"
  315. advanced_settings
  316. fi
  317. }
  318. function update_script() {
  319. clear
  320. header_info
  321. RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest |
  322. grep "tag_name" |
  323. awk '{print substr($2, 3, length($2)-4) }')
  324. msg_info "Stopping Services"
  325. systemctl stop openresty
  326. systemctl stop npm
  327. msg_ok "Stopped Services"
  328. msg_info "Cleaning Old Files"
  329. rm -rf /app \
  330. /var/www/html \
  331. /etc/nginx \
  332. /var/log/nginx \
  333. /var/lib/nginx \
  334. /var/cache/nginx &>/dev/null
  335. msg_ok "Cleaned Old Files"
  336. msg_info "Downloading NPM v${RELEASE}"
  337. wget -q https://codeload.github.com/NginxProxyManager/nginx-proxy-manager/tar.gz/v${RELEASE} -O - | tar -xz &>/dev/null
  338. cd nginx-proxy-manager-${RELEASE}
  339. msg_ok "Downloaded NPM v${RELEASE}"
  340. msg_info "Setting up Enviroment"
  341. ln -sf /usr/bin/python3 /usr/bin/python
  342. ln -sf /usr/bin/certbot /opt/certbot/bin/certbot
  343. ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
  344. ln -sf /usr/local/openresty/nginx/ /etc/nginx
  345. sed -i "s+0.0.0+${RELEASE}+g" backend/package.json
  346. sed -i "s+0.0.0+${RELEASE}+g" frontend/package.json
  347. sed -i 's+^daemon+#daemon+g' docker/rootfs/etc/nginx/nginx.conf
  348. NGINX_CONFS=$(find "$(pwd)" -type f -name "*.conf")
  349. for NGINX_CONF in $NGINX_CONFS; do
  350. sed -i 's+include conf.d+include /etc/nginx/conf.d+g' "$NGINX_CONF"
  351. done
  352. mkdir -p /var/www/html /etc/nginx/logs
  353. cp -r docker/rootfs/var/www/html/* /var/www/html/
  354. cp -r docker/rootfs/etc/nginx/* /etc/nginx/
  355. cp docker/rootfs/etc/letsencrypt.ini /etc/letsencrypt.ini
  356. cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-proxy-manager
  357. ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf
  358. rm -f /etc/nginx/conf.d/dev.conf
  359. mkdir -p /tmp/nginx/body \
  360. /run/nginx \
  361. /data/nginx \
  362. /data/custom_ssl \
  363. /data/logs \
  364. /data/access \
  365. /data/nginx/default_host \
  366. /data/nginx/default_www \
  367. /data/nginx/proxy_host \
  368. /data/nginx/redirection_host \
  369. /data/nginx/stream \
  370. /data/nginx/dead_host \
  371. /data/nginx/temp \
  372. /var/lib/nginx/cache/public \
  373. /var/lib/nginx/cache/private \
  374. /var/cache/nginx/proxy_temp
  375. chmod -R 777 /var/cache/nginx
  376. chown root /tmp/nginx
  377. echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf
  378. if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then
  379. echo -e "${CHECKMARK} \e[1;92m Generating dummy SSL Certificate... \e[0m"
  380. openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/O=Nginx Proxy Manager/OU=Dummy Certificate/CN=localhost" -keyout /data/nginx/dummykey.pem -out /data/nginx/dummycert.pem &>/dev/null
  381. fi
  382. mkdir -p /app/global /app/frontend/images
  383. cp -r backend/* /app
  384. cp -r global/* /app/global
  385. msg_ok "Setup Enviroment"
  386. msg_info "Building Frontend"
  387. cd ./frontend
  388. export NODE_ENV=development
  389. yarn install --network-timeout=30000 &>/dev/null
  390. yarn build &>/dev/null
  391. cp -r dist/* /app/frontend
  392. cp -r app-images/* /app/frontend/images
  393. msg_ok "Built Frontend"
  394. msg_info "Initializing Backend"
  395. rm -rf /app/config/default.json &>/dev/null
  396. if [ ! -f /app/config/production.json ]; then
  397. cat <<'EOF' >/app/config/production.json
  398. {
  399. "database": {
  400. "engine": "knex-native",
  401. "knex": {
  402. "client": "sqlite3",
  403. "connection": {
  404. "filename": "/data/database.sqlite"
  405. }
  406. }
  407. }
  408. }
  409. EOF
  410. fi
  411. cd /app
  412. export NODE_ENV=development
  413. yarn install --network-timeout=30000 &>/dev/null
  414. msg_ok "Initialized Backend"
  415. msg_info "Starting Services"
  416. systemctl enable npm &>/dev/null
  417. systemctl start openresty
  418. systemctl start npm
  419. msg_ok "Started Services"
  420. msg_info "Cleaning up"
  421. rm -rf nginx-proxy-manager-${RELEASE}
  422. msg_ok "Cleaned"
  423. msg_ok "Update Successfull"
  424. exit
  425. }
  426. clear
  427. if ! command -v pveversion >/dev/null 2>&1; then update_script; else install_script; fi
  428. if [ "$VERB" == "yes" ]; then set -x; fi
  429. if [ "$CT_TYPE" == "1" ]; then
  430. FEATURES="nesting=1,keyctl=1"
  431. else
  432. FEATURES="nesting=1"
  433. fi
  434. TEMP_DIR=$(mktemp -d)
  435. pushd $TEMP_DIR >/dev/null
  436. export VERBOSE=$VERB
  437. export STD=$VERB2
  438. export SSH_ROOT=${SSH}
  439. export CTID=$CT_ID
  440. export PCT_OSTYPE=$var_os
  441. export PCT_OSVERSION=$var_version
  442. export PCT_DISK_SIZE=$DISK_SIZE
  443. export PCT_OPTIONS="
  444. -features $FEATURES
  445. -hostname $HN
  446. $SD
  447. $NS
  448. -net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN$MTU
  449. -onboot 1
  450. -cores $CORE_COUNT
  451. -memory $RAM_SIZE
  452. -unprivileged $CT_TYPE
  453. $PW
  454. "
  455. bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
  456. msg_info "Starting LXC Container"
  457. pct start $CTID
  458. msg_ok "Started LXC Container"
  459. lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$var_install.sh)" || exit
  460. IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}')
  461. pct set $CTID -description "# ${APP} LXC
  462. ### https://tteck.github.io/Proxmox/
  463. <a href='https://ko-fi.com/D1D7EP4GF'><img src='https://img.shields.io/badge/☕-Buy me a coffee-red' /></a>"
  464. msg_ok "Completed Successfully!\n"
  465. echo -e "${APP} should be reachable by going to the following URL.
  466. ${BL}http://${IP}:81${CL} \n"