Categories
Uncategorized

Copy files from Linux to Windows using pscp

Google pscp and download it, save it so a directory i.e c:\utils\ Also create a directory on C where you want to save your restored files, i.e c:\restoredfiles

open a command prompt and type
[su_note]pscp username@hostname(or IP):/home/remoteusername/sampledir/* c:\restorefiles\ [/su_note]

Categories
Uncategorized

Puppet, puppet server, vagrant and virtual box

1.- Download Vagrant
[su_note]https://www.vagrantup.com/[/su_note]

2.- Create a directory in your home directory, i.e vagrantfiles

3.- Create a vagrant file inside your new directory
[su_note]vagrant init[/su_note]

4.- edit Vagrantfile to match the following,
[su_note]
MEMORY = “1024”
CPUS = “1”
Vagrant.configure(“2”) do |config|
config.vm.box = “centos/7”
config.vm.hostname = “master.puppet.vm”

config.vm.provider “virtualbox” do |vb|
vb.name = “master.puppet.vm”
vb.memory = MEMORY
vb.cpus = CPUS
end
end
[/su_note]

5.- On same directory where you have the Vagrant file, use [su_note]vagrant up [/su_note]to provision a new VM

6.- connect to the new vm
[su_note]vagrant ssh[/su_note]
Not required but run all commands as root,
[su_note]sudo su -[/su_note]

7.- Install Puppet, nano and git
[su_note]
rpm -Uvh https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm

yum install -y puppetserver nano git
[/su_note]
For Ubuntu 16.04 Xenial
[su_note]
wget https://apt.puppetlabs.com/puppet5-release-xenial.deb
sudo dpkg -i puppet5-release-xenial.deb
sudo apt update
[/su_note]
For Ubuntu 14.04 Trusty
[su_note]
wget https://apt.puppetlabs.com/puppet5-release-trusty.deb
sudo dpkg -i puppet5-release-trusty.deb
sudo apt-get update
[/su_note]

8. Edit . memory allocation
For Centos 7, the config file for puppetserver is located in:
[su_note]nano /etc/sysconfig/puppetserver [/su_note]
For Ubuntu 1604, the config file for puppetserver is located in:
[su_note]nano /etc/default/puppetserver [/su_note]
Edit 2g to 512mb
[su_note]#JAVA_ARGS=”-Xms2g -Xmx2g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogge$

JAVA_ARGS=”-Xms512m -Xmx512m -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4j$
[/su_note]

9.- start the puppet service and enable service at boot
[su_note]
systemctl start puppetserver
systemctl enable puppetserver
[/su_note]

Configure Puppet agent on server:

1.- edit puppet config and point the server to itself
[su_note]
nano /etc/puppetlabs/puppet/puppet.conf
[agent]
server = master.puppet.vm
[/su_note]

2.- Edit .bash_profile to allow using Ruby that’s installed with puppet
For Centos 7, edit the .bash_profile
[su_note]
nano .bash_profile
Replace the path to:
PATH=$PATH:/opt/puppetlabs/puppet/bin:$HOME/bin
[/su_note]

For Ubuntu 16.04,
[su_note]
export PATH=${PATH}:/opt/puppetlabs/puppet/bin
[/su_note]

To make it permanent, Ubuntu 16.04. Add the following at the end of .bashrc
[su_note]
export PATH=${PATH}:/opt/puppetlabs/puppet/bin
[/su_note]

3.- run source bash profile to make the changes active
For Centos 7
[su_note] source .bash_profile [/su_note]

For Ubuntu 16.04,
[su_note] source .profile [/su_note]

4.- Test it by running [su_note]gem [/su_note]
5.- Install r10k using gem
[su_note]gem install r10k[/su_note]

6.- Test: [su_note] puppet agent -t[/su_note]

 

Configure r10k to connect to github
1.- Create the directory:
[su_note]mkdir /etc/puppetlabs/r10k[/su_note]

2.- configure the yaml file
[su_note]nano /etc/puppetlabs/r10k/r10k.yaml [/su_note]

[su_note]

:cachedir: <space>’/var/cache/r10k’

:sources:
<space> :my-org:
<space><space> remote: <space>’https://github.com/username/work.git’
<space><space> basedir: <space>’/etc/puppetlabs/code/environments’
[/su_note]

3.-run
[su_note] r10k deploy environment -p[/su_note]
If you get an error with your yaml file,  go to http://www.yamllint.com/ to validate your yaml code then copy and paste the validated code into r10k.yaml

 

Categories
Uncategorized

Virtual box: share folders between Windows host and Ubuntu guests

Virtual box ver: 5.22

Create a folder in windows, i.e c:\shared
Open virtualbox.
Select your guest OS, i.e Ubuntu
Click settings
click Shared Folders, and add c:\shared  (enable auto mount)
Click OK
Start your guest OS (Ubuntu)
Login to your guest OS
Click Devices, click “Insert Guest Additions CD image…”
If the installation fails, install linux-headers with the following command
[su_note] sudo apt-get install linux-headers-$(uname -r) [/su_note]
Try again, click Devices,  “Insert Guest Additions CD image…”

Now check what shares are available.
[su_note] sudo VBoxControl sharedfolder list [/su_note]
You should see:
[su_note] 1. shared [/su_note]

Mount it:
First create a folder on your linux host, i.e mkdir  winfolder
then mount it.
[su_note] sudo mount -t vboxsf shared  ~/winfolder [/su_note]

Categories
Uncategorized

a start job is running for raise network interfaces

1.- edit, then reboot
[su_note]  /etc/systemd/system/network-online.targets.wants/networking.service [/su_note]
change timeout from 5 min to 1min
[su_note] TimeoutStartSec=5min [/su_note]