Last active
March 1, 2022 14:56
-
-
Save ianatha/ae22b6367e461a85af5911a36f6cc3a6 to your computer and use it in GitHub Desktop.
quick linux setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useradd -m -d /home/iwa -s /bin/bash iwa | |
mkdir /home/iwa/.ssh | |
curl -s https://api.github.com/users/ianatha/keys | grep '"key"' | grep --color=never -o "ssh-rsa .*[^\"]" > /home/iwa/.ssh/authorized_keys | |
chmod 0700 /home/iwa/.ssh | |
chmod 0600 /home/iwa/.ssh/authorized_keys | |
chown -R iwa:iwa /home/iwa/.ssh | |
usermod -a -G sudoers iwa || usermod -a -G sudo iwa || usermod -a -G wheel iwa | |
passwd iwa | |
curl -fsSL https://tailscale.com/install.sh | sh | |
tailscale up | |
curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - | |
apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | |
apt-get update && apt-get install consul nomad -y | |
tee /etc/consul.d/consul.hcl <<EOF | |
[...] | |
EOF | |
mv /etc/nomad /etc/nomad.d | |
tee /etc/nomad.d/client.hcl <<EOF | |
[...] | |
EOF | |
tee /etc/systemd/system/consul.service <<EOF | |
[Unit] | |
Description=Consul | |
Documentation=https://www.consul.io/ | |
[Service] | |
ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d/ | |
ExecReload=/bin/kill -HUP $MAINPID | |
LimitNOFILE=65536 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
tee /etc/systemd/system/nomad.service <<EOF | |
[Unit] | |
Description=Nomad | |
Documentation=https://www.nomadproject.io/docs/ | |
Wants=network-online.target | |
After=network-online.target | |
Wants=consul.service | |
After=consul.service | |
[Service] | |
ExecReload=/bin/kill -HUP $MAINPID | |
ExecStart=/usr/bin/nomad agent -config /etc/nomad.d | |
KillMode=process | |
KillSignal=SIGINT | |
LimitNOFILE=65536 | |
LimitNPROC=infinity | |
Restart=on-failure | |
RestartSec=2 | |
TasksMax=infinity | |
OOMScoreAdjust=-1000 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
systemctl enable consul | |
systemctl start consul | |
systemctl enable nomad | |
systemctl start nomad |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment