Child pages
  • Training virtual hosts in Google Cloud Platform
Skip to end of metadata
Go to start of metadata

Accessing the Servers

Web Access

http://train1.opmantek.net/cgi-nmis8/nmiscgi.pl

user = train

pass = nm1888

SSH Access

Training train user private key train-id_rsa 

-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA0es325Hdfj+8ac4byCqKsq7fz2BkmfNed2WXXnq7YEGzj8vz
y/E68o65KVSmy4BaijScuBG4s+9lFrHLdDFiJTcnunbny2eyi6w7AFAYVjZa4iiq
/NwSkir2m2kawiAGHsHodSDuxYHUnDJwShaweAFPTtWCfaWq08MThWAwCXmb66IL
Vas/k5YTLqSDqtxmHzGfpyoRUbzyNe7fI4AnXmSuiiohz7PCJcGzWRudikLaeOad
NF2kn2oWAP/M4f7visP76t4hL+IoOGocO1jW2QPaRmFKa6r4TKWrw6jx6MponVnP
v9YnYVv2FOljkkimid81Zk7IbiT7sgAIrVwJewIDAQABAoIBAQCXW3idEuGXpDEg
QQJ7I2F6UOkDR8eB0Z6tjEzGTMxKLVVhO3d/92G/fvU3Pdg+J0AhIqpVdkGtS9Gh
uXSvROQ1XT2CDzY2zYBJgVfRc+74SpzhMN2JEM07I0tI51Hp4tlG2B3aRnKjamd4
cE3SveVjwd4DQ6OhIRC5O5EZvC8mxH/JgPXLLoZX6zT+PuoQpy+XvyMk7I2aoxuJ
jRCLfnz35G8e9WICKXIbHNxyI8OqJoENwQs36iy4q5271Wri5z9epz6jSp3Rn+6U
4lmtUHFFAiu2xQlJqZbi5fDqGGjEEOe9166cr15QMrWBeBv9nElFyChtpvbJ+n0u
6jXCtBvhAoGBAPRws+81b6jraH9ErOE3V8HcduhGUe3EaWJ4uz70DSVMVPIagkNi
uZVG5/n7SoDUNBsg3dPRGew0vpsCdelkFuk6iFZWxphtA7hSrBP/m8DjZ45SjDAy
LFtqn1W2F9Mb8Ph91a/1970lRyJOztHHaq4668i49fHn1enqffCxfGrpAoGBANvY
lZdaMBLKtjmCV18aU/VYX7UzOvZtrGAjF2DRojmLRAVF0Z83ZpxyazV3QaVq55rL
uwdskzxGWVDkaLf3NEI4k6RlAb0og5K6TKw2hrvj+V2vMvddSfOSVBFhU1hPZFgx
+2/6EvhvtzmJKJ1a39byZp8rZ8m5LCycNCdHLYrDAoGBALhotjaG18BWKLWq98nI
2Ln2Ovas5m48OU0CzDCIKcqztXoYqaFwv5Vwst2SyPg8HztAJloAbFAY0pta1d3H
lslJUUXhnV2tEJtkM1G7CqQQazWh7QUHNROacq5U+9BWSgsN08I2DDpz/yBQ2BLH
ISJkbTE26MUhI+6e63hEThrRAoGAQfTyvFvUfG7QyOQv7lppwfvniud50yEITDd6
9hMuxnDf0W0m/MuUP2+cdof26/fs0GY7EHkkmzrH5RsBx9+kkBGFShb7tJKJFuZJ
xoj9VzWIRPEhK1GTtD28dxJp/N6kzkkAlJHES0DJCbv6sWroKQbEfxB4rO6fMCsV
Aou6QB0CgYEAiR0xhqxI78tuKUyE368tkNfekfagVqGkRdm6IwVyZJU7HlQtd+RX
/TgNUYd4ZAvu342hm6J8xatrNqx6JpdT3WpYUExzHXm47fZjiYvD2sDeoK8/moyT
KBAs1v3c4GDHgzCdmbC5J+vrKU6ZGcl6nObGtlu0B8SEaVJCu43jloc=
-----END RSA PRIVATE KEY-----

Chmod file and tell SSH to use it.

chmod 600 ~/.ssh/train-id_rsa
ssh -i ~/.ssh/train-id_rsa train@train1.opmantek.net

sudo access

NM1$88


Making the Servers

Install the GCLOUD CLI Tools

https://cloud.google.com/sdk/docs/downloads-versioned-archives

Authenticate and Verify the CLI tools

gcloud auth login
gcloud config set project opmantek-186304
gcloud compute instances list 

Update the Snapshot from train1.opmantek.net template

# SET the SNAPSHOT TO USE
SNAPSHOT=train-snap1
gcloud compute disks snapshot train1 --project=opmantek-186304 --snapshot-names=$SNAPSHOT --zone=us-west2-a --storage-location=us

Create an Instance

Setup Environment

# SET THE SERVER NAME TO CREATE, e.g. train2
TRAIN=train2
# SET the SNAPSHOT TO USE
SNAPSHOT=train-snap1

Create an the disk from the snapshot

# run these commands which will use the snapshot
gcloud compute --project "opmantek-186304" disks create $TRAIN --size "20" --zone "us-west2-a" --source-snapshot $SNAPSHOT --type "pd-standard"

IGNORE: "WARNING: You have selected a disk size of under [200GB]"

When that finishes you can use it.

Create the VM

gcloud compute --project=opmantek-186304 instances create $TRAIN --zone=us-west2-a --machine-type=n1-standard-1 --subnet=default --network-tier=PREMIUM --metadata=serial-port-enable=true --maintenance-policy=MIGRATE --service-account=710830216003-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --tags=training,http-server,https-server --disk=name=$TRAIN,device-name=$TRAIN,mode=rw,boot=yes,auto-delete=yes --reservation-affinity=any

It will respond with details about the VM including the IP address

NAME    ZONE        MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP   STATUS
train3  us-west2-a  n1-standard-1               10.168.0.7   35.236.52.66  RUNNING

Add DNS entry for server

email to ops@opmantek.com to get the dns setup

Changes to the Server once it boots

sudo bash
HOSTNAME=train1
echo $HOSTNAME > /etc/hostname
hostname $HOSTNAME
/usr/local/nmis8/admin/patch_config.pl /usr/local/nmis8/conf/Config.nmis /system/nmis_host=$HOSTNAME.opmantek.net /system/server_name=$HOSTNAME


Success

NAME    ZONE        MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP    STATUS
train2  us-west2-a  n1-standard-1               10.168.0.13  34.94.124.138  RUNNING
train3  us-west2-a  n1-standard-1               10.168.0.14  34.94.193.149  RUNNING
train4  us-west2-a  n1-standard-1               10.168.0.15  34.94.227.121  RUNNING
train5  us-west2-a  n1-standard-1               10.168.0.16  34.94.103.132  RUNNING
train6  us-west2-a  n1-standard-1               10.168.0.17  34.94.119.30  RUNNING
train7  us-west2-a  n1-standard-1               10.168.0.18  35.235.121.90  RUNNING
train8  us-west2-a  n1-standard-1               10.168.0.19  35.235.78.128  RUNNING
trainer  us-west2-a  n1-standard-1               10.168.0.20  35.235.82.217  RUNNING


Basic Admin to Setup the Users

sudo usermod -a -G nmis train
sudo usermod -a -G sudo train






  • No labels