Showing posts with label Data. Show all posts
Showing posts with label Data. Show all posts

Friday 29 September 2017

Working with PuppetLabs Using Vagrant


While working as DevOps Engineer one of the tools by definition that we use more, often is Puppet. Guess most people will think that you are 100% expert, which is not always the case. So, I need to create this post and track record of my own experiments with Puppet and (PuppetLabs + Vagrant)

You might as what is Vagrant ?
==> "Vagrant is an open-source software product for building and maintaining portable virtual software development environments, e.g. for VirtualBox, Hyper-V, Docker, VMware, and AWS. ... Vagrant simplifies the necessary software configuration management in order to increase development productivity. " read more here: https://www.vagrantup.com/intro/index.html

The initial indentation was to gain better understanding puppet file structure. So, I decided to use Puppetlabs for this ...
















So, basically. I did create installed

  • Installed Vagrant
  • Used the Vagrant init command to pull the puppetlabs ubuntu VM
  • Which created a file "Vagrantfile"
  • created a dir puppetlabs


And then started the Setup, so here are the Logs ..

Tdls-Air:puppetlabs psalms91$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'puppetlabs/ubuntu-16.04-32-puppet' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: 1.0.0
==> default: Loading metadata for box 'puppetlabs/ubuntu-16.04-32-puppet'
    default: URL: https://vagrantcloud.com/puppetlabs/ubuntu-16.04-32-puppet
==> default: Adding box 'puppetlabs/ubuntu-16.04-32-puppet' (v1.0.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-16.04-32-puppet/versions/1.0.0/providers/virtualbox.box
==> default: Successfully added box 'puppetlabs/ubuntu-16.04-32-puppet' (v1.0.0) for 'virtualbox'!
==> default: Importing base box 'puppetlabs/ubuntu-16.04-32-puppet'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'puppetlabs/ubuntu-16.04-32-puppet' is up to date...
==> default: Setting the name of the VM: puppetlabs_default_1506687306250_65705
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 5.0.20
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => /Users/psalms91/Vagrant_VM/puppetlabs
Tdls-Air:puppetlabs psalms91$

Tdls-Air:puppetlabs psalms91$ vagrant ssh

Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-21-generic i686)

 * Documentation:  https://help.ubuntu.com/

vagrant@localhost:~$

After this I have my Puppet Labs VM running ... After this point was easy, I just needed to goo into the puppet installation dir and look into the dir structure.


done.. :-)

Tuesday 23 December 2014

Some Things I've learnt about GNS3

I am in no way an expert on GNS3, just a trainee   below are a few things i have learnt lately. I thought it might be a good idea to produce something like this. If everyone replied to it and added a few tips of their own it could be turned into a CLN GNS3 tips and tricks document.


GNS3 Web Sites
http://www.gns3.net GNS3’s primary Web site
http://wiki.gns3.net GNS3’s Wiki site
http://www.ipflow.utc.fr/index.php/Cisco_7200_Simulator Dynamips – the actual emulator

http://www.ipflow.utc.fr/blog/ Dynamips blog
http://dyna-gen.sourceforge.net/ Dynagen
http://www.ipflow.utc.fr/bts/ Dynamips/Dynagen bug tracking
http://7200emu.hacki.at Hacki’s forum
===

1. GNS3 has less chance of crashing if the bin files are unzipped.

2. Currently images for 2600 routers must be uncompressed to work with Dynamips.

3. To dramatically reduce the load on your processor, right click on the router and choose idle, after a few moments it will give you a list to choose from.
Choose the one with a * against it, if you don't see a * in the choice run it again.

4. If you don't need any special routers then use the same type on the whole lab, this will use far less processing power and memory.

5. To print out the diagram of your network click file then export, you can export all or just what is visible.

6. To move your router/routers/links etc click the left mouse button and draw around what you want to move, you can then move everything that is inside that shape.

7. I find that if you move around the interface identities they eventually go back to their original position. I don't move them anymore as it looks a bit
messy when that happens.

8. You can't use GNS3 for the SWITCH studies, GNS3 only has basic switch capabilities.

9. You can create computers and run ping's/telnet with VPC, the document attached shows you how, its very simple to follow. I did find that it takes a few times for it to accept being a cloud, once you click ok just open it back up and check it.

10. I personally find that it is best to connect your links between routers when they are switched off, sometimes i find it fails otherwise.

11. You can create a router to act like a pc, this is shown below but it is also in the document.


Router(config)# no ip routing         Turns off IP routing function
Router(config)# interface fa0/0      Switches to FastEthernet interface
Router(config-if)# ip address address subnet_mask Assigns IP address and subnet mask to interface
Router(config-if)# no shutdown      Turns interface on
Router(config-if)# exit                     Returns to global configuration mode
Router(config)# ip default-gateway gateway_address Configures the default gateway
Router(config)# ip http server         Optional – starts http server process
===

12. You can connect GNS3 to real equipment, i have not done this yet myself, it is in the document attached how to do this.

13. When using windows 64 bit GNS3 will default to program files (x86). GNS3 is a 32 bit program for windows so point it to program files not the (x86).

14. I have a Lenovo Thinkpad with a i7 processor and 4GB of RAM. With 7 routers of the same type my processor is running between 8 and 15 %, my RAM consumption is around 2.3 to 2.8 GB. That is also using a few other programs on my laptop at the sometimes.

Thursday 11 July 2013

Solve VMWare Workstation 9 Error on Linux Kernel 3.8.0-26



I have VMware Workstations 9 installed on my uBuntu 13 machine and today without any apparent reason it stop working throwing me the following error, every time I've tried to boot up any VM machine.


To solver the problem .. here is what I have done ... created bash script to handle problems with VMware Player on 13.04 ...




  • #!/bin/bash
  • if [[ $UID != 0 ]]; then
  •     echo "Please run this script with sudo:"
  •     echo "sudo $0 $*"
  •     exit 1
  • fi
  • sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h
  • cd /usr/lib/vmware/modules/source
  • sudo tar -xf vmci.tar
  • cd vmci-only
  • sudo sed '127s/.*/   .remove = vmci_remove_device,/' driver.c > driver.c.tmp
  • mv driver.c.tmp driver.c
  • sudo sed '1753s/.*/static int/' driver.c > driver.c.tmp
  • mv driver.c.tmp driver.c
  • sudo sed '1981s/.*/static void/' driver.c > driver.c.tmp
  • mv driver.c.tmp driver.c
  • cd ..
  • sudo tar -cf vmci.tar vmci-only/
  • sudo rm vmci-only/ -Rf
  • sudo vmware-modconfig --console --install-all
  • sudo rm /usr/src
  • Before write the script I've open the terminal and type " #sudo kate " then when kate opened I entered the script and saved on " /usr/src/open-vm-tools-xxxx.xx.xx" (replace the x with year month and day) and save it. Then close Kate

    The Open terminal again and do the following;


    after you should have VMware workstation running...



    This is another posting showing "how to do computing" for everyday computer usages... For a general public

    Wednesday 23 January 2013

    All You Need To Know About Linux Commands



    System Info


    date – Show the current date and time
    cal – Show this month's calendar
    uptime – Show current uptime
    w – Display who is online
    whoami – Who you are logged in as
    finger user – Display information about user
    uname -a – Show kernel information
    cat /proc/cpuinfo – CPU information
    cat /proc/meminfo – Memory information
    df – Show disk usage
    du – Show directory space usage
    free – Show memory and swap usage

    Keyboard Shortcuts

    Enter – Run the command
    Up Arrow – Show the previous command
    Ctrl + R – Allows you to type a part of the command you're looking for and finds it
    Ctrl + Z – Stops the current command, resume with fg in the foreground or bg in the background
    Ctrl + C – Halts the current command, cancel the current operation and/or start with a fresh new line
    Ctrl + L – Clear the screen

    command | less – Allows the scrolling of the bash command window using Shift + Up Arrow and Shift + Down Arrow
    !! – Repeats the last command
    command  !$ – Repeats the last argument of the previous command
    Esc + . (a period) – Insert the last argument of the previous command on the fly, which enables you to edit it before executing the command

    Ctrl + A – Return to the start of the command you're typing
    Ctrl + E – Go to the end of the command you're typing
    Ctrl + U – Cut everything before the cursor to a special clipboard, erases the whole line
    Ctrl + K – Cut everything after the cursor to a special clipboard
    Ctrl + Y – Paste from the special clipboard that Ctrl + U and Ctrl + K save their data to
    Ctrl + T – Swap the two characters before the cursor (you can actually use this to transport a character from the left to the right, try it!)
    Ctrl + W – Delete the word / argument left of the cursor in the current line
    Ctrl + D – Log out of current session, similar to exit

    Learn the Commands

    apropos subject – List manual pages for subject
    man -k keyword – Display man pages containing keyword
    man command – Show the manual for command
    man -t man | ps2pdf - > man.pdf  – Make a pdf of a manual page
    which command – Show full path name of command
    time command – See how long a command takes

    whereis app – Show possible locations of app
    which app – Show which app will be run by default; it shows the full path

    Searching

    grep pattern files – Search for pattern in files
    grep -r pattern dir – Search recursively for pattern in dir
    command | grep pattern – Search for pattern in the output of command
    locate file – Find all instances of file
    find / -name filename – Starting with the root directory, look for the file called filename
    find / -name ”*filename*” – Starting with the root directory, look for the file containing the string 

    filename

    locate filename – Find a file called filename using the locate command; this assumes you have already used the command updatedb (see next)
    updatedb – Create or update the database of files on all file systems attached to the Linux root directory
    which filename – Show the subdirectory containing the executable file  called filename
    grep TextStringToFind /dir – Starting with the directory called dir, look for and list all files containing TextStringToFind

    File Permissions

    chmod octal file – Change the permissions of file to octal, which can be found separately for user, group, and world by adding: 4 – read (r), 2 – write (w), 1 – execute (x)
    Examples:
    chmod 777 – read, write, execute for all
    chmod 755 – rwx for owner, rx for group and world
    For more options, see man chmod.

    File Commands

    ls – Directory listing
    ls -l – List files in current directory using long format
    ls -laC – List all files in current directory in long format and display in columns
    ls -F – List files in current directory and indicate the file type
    ls -al – Formatted listing with hidden files
    cd dir – Change directory to dir
    cd – Change to home
    mkdir dir – Create a directory dir
    pwd – Show current directory

    rm name – Remove a file or directory called name
    rm -r dir – Delete directory dir
    rm -f file – Force remove file
    rm -rf dir – Force remove an entire directory dir and all it’s included files and subdirectories (use with extreme caution)

    cp file1 file2 – Copy file1 to file2
    cp -r dir1 dir2 – Copy dir1 to dir2; create dir2 if it doesn't exist
    cp file /home/dirname – Copy the file called filename to the /home/dirname directory

    mv file /home/dirname – Move the file called filename to the /home/dirname directory
    mv file1 file2 – Rename or move file1 to file2; if file2 is an existing directory, moves file1 into directory file2

    ln -s file link – Create symbolic link link to file
    touch file – Create or update file
    cat > file – Places standard input into file
    cat file – Display the file called file

    more file – Display the file called file one page at a time, proceed to next page using the spacebar
    head file – Output the first 10 lines of file
    head -20 file – Display the first 20 lines of the file called file
    tail file – Output the last 10 lines of file
    tail -20 file – Display the last 20 lines of the file called file
    tail -f file – Output the contents of file as it grows, starting with the last 10 lines

    Compression

    tar cf file.tar files – Create a tar named file.tar containing files
    tar xf file.tar – Extract the files from file.tar
    tar czf file.tar.gz files – Create a tar with Gzip compression
    tar xzf file.tar.gz – Extract a tar using Gzip
    tar cjf file.tar.bz2 – Create a tar with Bzip2 compression
    tar xjf file.tar.bz2 – Extract a tar using Bzip2
    gzip file – Compresses file and renames it to file.gz
    gzip -d file.gz – Decompresses file.gz back to file

    Printing

    /etc/rc.d/init.d/lpd start – Start the print daemon
    /etc/rc.d/init.d/lpd stop – Stop the print daemon
    /etc/rc.d/init.d/lpd status – Display status of the print daemon
    lpq – Display jobs in print queue
    lprm – Remove jobs from queue
    lpr – Print a file
    lpc – Printer control tool
    man subject | lpr – Print the manual page called subject as plain text
    man -t subject | lpr – Print the manual page called subject as Postscript output
    printtool – Start X printer setup interface

    Network

    ifconfig – List IP addresses for all devices on the local machine
    ping host – Ping host and output results
    whois domain – Get whois information for domain
    dig domain – Get DNS information for domain
    dig -x host – Reverse lookup host
    wget file – Download file
    wget -c file – Continue a stopped download

    SSH

    ssh user@host – Connect to host as user
    ssh -p port user@host – Connect to host on port port as user
    ssh-copy-id user@host – Add your key to host for user to enable a keyed or passwordless login

    User Administration

    adduser accountname – Create a new user call accountname
    passwd accountname – Give accountname a new password
    su – Log in as superuser from current login
    exit – Stop being superuser and revert to normal user

    Process Management

    ps – Display your currently active processes
    top – Display all running processes
    kill pid – Kill process id pid
    killall proc – Kill all processes named proc (use with extreme caution)
    bg – Lists stopped or background jobs; resume a stopped job in the background
    fg – Brings the most recent job to foreground
    fg n – Brings job n to the foreground

    Installation from source

    ./configure
    make
    make install
    dpkg -i pkg.deb – install a DEB package (Debian / Ubuntu / Linux Mint)
    rpm -Uvh pkg.rpm – install a RPM package (Red Hat / Fedora)

    Stopping & Starting

    shutdown -h now – Shutdown the system now and do not reboot
    halt – Stop all processes - same as above
    shutdown -r 5 – Shutdown the system in 5 minutes and reboot
    shutdown -r now – Shutdown the system now and reboot
    reboot – Stop all processes and then reboot - same as above
    startx – Start the X system



    Recommended reading:

    Cheat-Sheets.org – All cheat sheets, round-ups, quick reference cards, quick reference guides and quick reference sheets in one page. The only one you need.

    Tutorial: The best tips & tricks for bash, explained – Linux Tutorial Blog / Quality Linux tutorials without clutter

    LinuxCommand.org – Learning the shell, Writing shell scripts, Script library, SuperMan pages, Who, What, Where, Why

    LinuxManPages.com – General commands, System calls, Subroutines, Special files, File formats, Games, Macros and conventions, Maintenence commands, Most Popular Man Pages

    Linux Newbie Guide: Shorcuts and Commands - Linux essential shortcuts and sanity commands; Common Linux commands - system info; Basic operations, network apps, file (de)compression; Process control; Basic administration commands, accessing drives/partitions; Network administration tools, music-related commands, graphics-related commands.


    Thursday 13 December 2012

    Using Virtual Ethernet Adapters in Promiscuous Mode on a Linux Host


    VMware Workstation does not allow the virtual Ethernet adapter to go into promiscuous mode unless the user running VMware Workstation has permission to make that setting. This follows the standard Linux practice that only root can put a network interface into promiscuous mode.

    When you install and configure VMware Workstation, you must run the installation as root. VMware Workstation creates the VMnet devices with root ownership and root group ownership, which means that only root has read and write permissions to the devices.

    To set the virtual machine's Ethernet adapter to promiscuous mode, you must launch VMware Workstation as root because you must have read and write access to the VMnet device. For example, if you are using bridged networking, you must have access to /dev/vmnet0.

    To grant selected other users read and write access to the VMnet device, you can create a new group, add the appropriate users to the group and grant that group read and write access to the appropriate device. You must make these changes on the host operating system as root (su -). For example, you can enter the following commands:

    chgrp <newgroup> /dev/vmnet0

    chmod g+rw /dev/vmnet0

    <newgroup> is the group that should have the ability to set vmnet0 to promiscuous mode.
    The command to run vmware workstations ads root is simple: user@user#:~$ sudo vmware start

    If you want all users to be able to set the virtual Ethernet adapter (/dev/vmnet0 in our example) to promiscuous mode, run the following command on the host operating system as root:

    chmod a+rw /dev/vmnet0


    This is another posting showing "how to do computing" for everyday computer usages... For a general public

    Tuesday 27 March 2012

    Lost you Data ? Hard Drive file system corrupted ..I think this might help


    Recovering deleted files after you have emptied the Recycle Bin, including Word, Excel, PowerPoint, email, photo, database and more files...

    The easy recovery software - Data Recovery Wizard restores deleted files no longer in the Recycle Bin. It can recover the deleted Word, Excel, PowerPoint, photo, Email, database, and all document formats and folders in Windows 2000, XP, 2003, Vista, 2008, Windows 7, which have been emptied from or by-passed the Windows Recycle Bin.


    Why can you recover deleted files?

    Emergency file recovery requires more than the correct tool, though. It is requested to know how file deletion occurs, and what you have to do to maximize the chances of a successful recovery.
    When a file is deleted from your computer, you just lose the file entry in My Computer. The file content still exists on the hard disk, Windows simply marks the hard drive space as being available for use so that you can write new files. If you manage to start an undelete process before Windows uses that part of the hard drive to write a new file, all you have to do is set that flag back to "on" and you get the file.
    Obviously, the sooner you try to restore a file, the more successful you'll be. But stop a moment and think about the other things that could cause this part of the hard drive to be overwritten. If your hard drive is pretty full, the odds are much greater that Windows will grab your precious unallocated space for its next write. Or, if you defrag the hard drive, you run the risk of unused parts of the drive being overwritten! (This also means that if you are running silent background defrags services like Diskeeper, or if you have defragged utilities scheduled to defrag automatically, you might get blindsided - lose your chance at data recovery - if you don't halt them until you have your deleted file recovered.
    For that matter, simply starting up Windows or, to a lesser extent, shutting down Windows causes many tiny files to be written. You really want to avoid these processes if possible.
    So the first rule is: Stop using that computer immediately! This minute! Right now! Use another computer to get the Data Recovery Wizard you need. Please see: How to install a hard drive?
    This is also one of the places where the well-planned partitioning of your hard drive has a huge advantage. Partitions physically mark off different parts of the hard drive. If, for example, you have your data and program files on their own separate partitions, and it's a data file that you want to recover (which is usually the case), then Windows startup or shutdown won't touch that part of the hard drive. If you have the swapfile / pagefile on its own partition, and all of your directories for temporary files on another, then these most-changing and most-written files will also be kept from overwriting the part of the drive holding the files you want to recover. However, if you take that 80 GB hard drive and make it all one big single C: partition, then you run the risk of making your file unrecoverable anytime the swapfile resizes, or any time Windows writes a temporary file of any kind... and this could be pretty much at any moment whatsoever! Partitioning gives enormous advantage in file recovery.

    Mastering Docker Minified Systems: A Step-by-Step Guide with Real Use Cases

    Introduction Docker is a powerful platform for developing, shipping, and running applications. Minified Docker systems are optimized for siz...