Categories
Uncategorized

Grunt, Sass and Nodejs on Linux

Install Nodejs v6. This will install npm, which will allow to install grunt-cli globally (-g)
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash –
sudo apt-get install -y build-essential
sudo npm install -g grunt-cli

Install Sass. First install Ruby. This will install gem
sudo apt-get install rubygems build-essential
sudo gem install sass

Install Sas-contrib locally on project, i.e /apps/wp
:/apps/wp/npm install grunt-contrib-sas –save-dev

If you get a warning:  grunt-contrib-sass requires a peer of grunt
run, npm install grunt –save-dev

To start grunt: go to project folder
grunt

To stop grunt, go back to project folder
Ctrl + c

Categories
Uncategorized

docker

List images:
docker images

check running containers
docker ps 

check last running container
docker ps -l

change from table to vertical display, first copy/paste the following in the command line
export FORMAT=”ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\nPORTS\t{{.Ports}}\n”

 Now you can use
docker ps -l –format=”$FORMAT”

Docker commit command: make images out of a container,
First, run a container, docker run -ti ubuntu bash
exit
check latest container, docker ps -l –format=”$FORMAT”
ID 597ff54633b9
NAME agitated_elion
IMAGE ubuntu
COMMAND “bash”
CREATED 2017-06-08 09:48:29 -0400 EDT
STATUS Exited (0) 2 minutes ago
PORTS

docker commit nameofImage neimagename
docker commit agigated_elion copyofUbuntu

run container and delete it when it exits
docker run –rm –ti ubuntu sleep 10

Run a few more things
docker run -rm –ti ubuntu bash -c “sleep 5; echo  returning done sleeping” 

Leaving a running container i.e detached
docker run -d -ti ubuntu bash
docker ps -l –format=”$FORMAT”
ID 4b2feb75ca6b
NAME thirsty_liskov
IMAGE ubuntu
COMMAND “bash”
CREATED 2017-06-08 09:59:39 -0400 EDT
STATUS Up 8 seconds
PORTS

Attach running container,
docker attach thirsty_liskov
If you want to exit and keep it running
Press Ctrl + P and Ctrl+q, this detaches it but leaves it running

execute a new process in a running container,
docker exec thirsty_liskov bash

Kill and remove containers
docker  kill containerName
docker rm containerName

NETWORKING

Categories
Uncategorized

SSH: Login without a password

1.- On client computer, create private/public keys: Accept all defaults

ssh-keygen -t rsa

2.- copy public key to remote host

ssh-copy-id -i ~/.ssh/id_rsa.pub  remotehost

3. test

ssh remotehost

4.- Disable Password login, edit /etc/ssh_config

Find PasswordAuthentication

Change it from #PasswordAuthentication yes to PasswordAuthentication no

5.- Restart sshd

systemctl restart sshd
Categories
Uncategorized

Configuring a NIS client and mounting home directories from an NFS server

First Configure NIS

  1. Edit /etc/passwd and add the following at the end of the file
+::::::

2. Edit /etc/group and add the following at the end of the file

+:::

3. Edit /etc/shadow and add the following at the end of the file

+::::::::

4.  Edit /etc/yp.conf

ypserver 192.168.1.10

ypserver 192.168.1.11

5.- Reboot or restart NIS /etc/init.d/nis restart

 

Now, mount the home dirs using NFS

  1. Edit /etc/auto.master
  2. /home /etc/auto.home --timeout=60

2.  create a new file in /etc/home.auto and add the following

* -fstype=nfs,rw,nosuid,soft,fsid=0 hostname:/mnt/Volume1/home/&

To find the hostname and the mount point for the NFS server, from a pre-configure client run df -kh