インストール(root)
useradd deno -m -s /bin/bash
su - deno
curl -fsSL https://deno.land/x/install/install.sh | sh
cat <<'EOL' >> ~/.bashrc
export DENO_INSTALL="/home/deno/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
EOL
source ~/.bashrc
deno install -qAf --unstable https://deno.land/x/denon/denon.ts
mkdir ~/example
cat <<'EOL' > ~/example/main.ts
import { serve } from 'https://deno.land/std@0.165.0/http/server.ts';
function handler() {
console.log('log test');
console.error('error log test');
return new Response('Hello, World!');
}
serve(handler);
EOL
exit
cat <<'EOL' > /etc/systemd/system/example.service
[Service]
User=deno
WorkingDirectory=/home/deno/example
ExecStart=/bin/bash -c 'PATH=/home/deno/.deno/bin && denon run --allow-net main.ts'
[Install]
WantedBy=multi-user.target
EOL
systemctl enable example
reboot
アンインストール(root)
systemctl stop example
systemctl disable example
rm /etc/systemd/system/example.service
rm -rf /home/deno
userdel deno