Showing posts with label Gnome. Show all posts
Showing posts with label Gnome. 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 24 March 2015

Error while trying to update Ubuntu 14.04 LTS

Hi all this morning, as usual I was kind updating my Ubuntu and part of my normal system maintenance check up and find this error, while trying to update my system.


It seems strange to me, after a quick google - I found a work around on this website on AskUbuntu forum.. http://askubuntu.com/questions/599112/google-chrome-ppa-upgrade-invalid-signature.

"
Open a terminal and enter the following:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
 
That will import Google's updated GPG Key.

You should be able to update the system without any errors.
Source: Google Linux Repositories
"

Tuesday 10 September 2013

Linux Containers on Virtualbox - Disposal Boxes by Michal Migurski's

Hey look, a month went by and I stopped blogging because I have a new job. Great.
One of my responsibilities is keeping an eye on our sprawling Github account, currently at 326 repositories and 151 members. The current fellows are working on a huge number of projects and I frequently need to be able to quickly install, test and run projects with a weirdly-large variety of backend and server technologies. So, it’s become incredibly important to me to be able to rapidly spin up disposable Linux web servers to test with. Seth clued me in to Linux Containers (LXC) for this:
LXC provides operating system-level virtualization not via a full blown virtual machine, but rather provides a virtual environment that has its own process and network space. LXC relies on the Linux kernel cgroups functionality that became available in version 2.6.24, developed as part of LXC. … It is used by Heroku to provide separation between their “dynos.”
I use a Mac, so I’m running these under Virtualbox. I move around between a number of different networks, so each server container had to have a no-hassle network connection. I’m also impatient, so I really needed to be able to clone these in seconds and have them ready to use.
This is a guide for creating an Ubuntu Linux virtual machine under Virtualbox to host individual containers with simple two-way network connectivity. You’ll be able to clone a container with a single command, and connect to it using a simple <container>.local host name.

The Linux Host

First, download an Ubuntu ISO. I try to stick to the long-term support releases, so I’m using Ubuntu 12.04 here. Get a copy of Virtualbox, also free.
Create a new Virtualbox virtual machine to boot from the Ubuntu installation ISO. For a root volume, I selected the VDI format with a size of 32GB. The disk image will expand as it’s allocated, so it won’t take up all that space right away. I manually created three partitions on the volume:
  1. 4.0 GB ext4 primary.
  2. 512 MB swap, matching RAM size. Could use more.
  3. All remaining space btrfs, mounted at /var/lib/lxc.
Btrfs (B-tree file system, pronounced “Butter F S”, “Butterfuss”, “Better F S”, or “B-tree F S") is a GPL-licensed experimental copy-on-write file system. It will allow our cloned containers to occupy only as much disk space as is changed, which will decrease the overall file size of the virtual machine.
During the OS installation process, you’ll need to select a host name. I used “ubuntu-demo” for this demonstration.

Host Linux Networking

Boot into Linux. I started by installing some basics, for me: git, vim, tcsh, screen, htop, and etckeeper.
Set up /etc/network/interfaces with two bridges for eth0 and eth1, both DHCP. Note that eth0 and eth1 must be commented-out, as in this sample part of my /etc/network/interfaces:
## The primary network interface
#auto eth0
#iface eth0 inet dhcp

auto br0
iface br0 inet dhcp
        dns-nameservers 8.8.8.8
        bridge_ports eth0
        bridge_fd 0
        bridge_maxwait 0

auto br1
iface br1 inet dhcp
        bridge_ports eth1
        bridge_fd 0
        bridge_maxwait 0
Back in Virtualbox preferencese, create a new network adapter and call it “vboxnet0”. My settings are 10.1.0.1, 255.255.255.0, with DHCP turned on.


Shut down the Linux host, and add the secondary interface in Virtual box. Choose host-only networking, the vboxnet0 adapter, and “Allow All” promiscuous mode so that the containers can see inbound network traffic.

The primary interface will be NAT by default, which will carry normal out-bound internet traffic.
  1. Adapter 1: NAT (default)
  2. Adapter 2: Host-Only vboxnet0
Start up the Linux host again, and you should now be able to ping the outside world.
% ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=63 time=340 ms
…
Use ifconfig to find your Linux IP address (mine is 10.1.0.2), and try ssh’ing to that address from your Mac command line with the username you chose during initial Ubuntu installation.
% ifconfig br1

br1       Link encap:Ethernet  HWaddr 08:00:27:94:df:ed  
          inet addr:10.1.0.2  Bcast:10.1.0.255  Mask:255.255.255.0
          inet6 addr: …
Next, we’ll set up Avahi to broadcast host names so we don’t need to remember DHCP-assigned IP addresses. On the Linux host, install avahi-daemon:
% apt-get install avahi-daemon
In the configuration file /etc/avahi/avahi-daemon.conf, change these lines to clarify that our host names need only work on the second, host-only network adapter:
allow-interfaces=br1,eth1
deny-interfaces=br0,eth0,lxcbr0
Then restart Avahi.
% sudo service avahi-daemon restart
Now, you should be able to ping and ssh to ubuntu-demo.local from within the virtual machine and your Mac command line.

No Guest Containers

So far, we have a Linux virtual machine with a reliable two-way network connection that’s resilient to external network failures, available via a meaningful host name, and with a slightly funny disk setup. You could stop here, skipping the LXC steps and use Virtualbox’s built-in cloning functionality or something like Vagrant to set up fresh development environments. I’m going to keep going and set up LXC.

Linux Guest Containers

Install LXC.
% sudo apt-get lxc
Initial LXC setup uses templates, and on Ubuntu there are several useful ones that come with the package. You can find them under /usr/lib/lxc/templates; I have templates for ubuntu, fedora, debian, opensuse, and other popular Linux distributions. To create a new container called “base” use lxc-create with a chosen template.
% sudo lxc-create -n base -t ubuntu
This takes a few minutes, because it needs retrieve a bunch of packages for a minimal Ubuntu system. You’ll see this message at some point:
##
# The default user is 'ubuntu' with password 'ubuntu'!
# Use the 'sudo' command to run tasks as root in the container.
##
Without starting the container, modify its network adapters to match the two we set up earlier. Edit the top of /var/lib/lxc/base/config to look something like this:
lxc.network.type=veth
lxc.network.link=br0
lxc.network.flags=up
lxc.network.hwaddr = 00:16:3e:c2:9d:71

lxc.network.type=veth
lxc.network.link=br1
lxc.network.flags=up
lxc.network.hwaddr = 00:16:3e:c2:9d:72
An initial MAC address will be randomly generated for you under lxc.network.hwaddr, just make sure that the second one is different.
Modify the container’s network interfaces by editing /var/lib/lxc/base/rootfs/etc/network/interfaces (/var/lib/lxc/base/rootfs is the root filesystem of the new container) to look like this:
auto eth0
iface eth0 inet dhcp
        dns-nameservers 8.8.8.8

auto eth1
iface eth1 inet dhcp
Now your container knows about two network adapters, and they have been bridged to the Linux host OS virtual machine NAT and host-only adapters. Start your new container:
% sudo lxc-start -n base
You’ll see a normal Linux login screen at first, use the default username and password “ubuntu” and “ubuntu” from above. The system starts out with minimal packages. Install a few so you can get around, and include language-pack-en so you don’t get a bunch of annoying character set warnings:
% sudo apt-get install language-pack-en
% sudo apt-get install git vim tcsh screen htop etckeeper
% sudo apt-get install avahi-daemon
Make a similar change to the /etc/avahi/avahi-daemon.conf as above:
allow-interfaces=eth1
deny-interfaces=eth0
Shut down to return to the Linux host OS.
% sudo shutdown -h now
Now, restart the container with all the above modifications, in daemon mode.
% sudo lxc-start -d -n base
After it’s started up, you should be able to ping and ssh to base.local from your Linux host OS and your Mac.
% ssh ubuntu@base.local

Cloning a Container

Finally, we will clone the base container. If you’re curious about the effects of Btrfs, check the overall disk usage of the /var/lib/lxc volume where the containers are stored:
% df -h /var/lib/lxc

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        28G  572M   26G   3% /var/lib/lxc
Clone the base container to a new one, called “clone”.
% sudo lxc-clone  -o base -n clone
Look at the disk usage again, and you will see that it’s not grown by much.
% df -h /var/lib/lxc

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        28G  573M   26G   3% /var/lib/lxc
If you actually look at the disk usage of the individual container directories, you’ll see that Btrfs is allowing 1.1GB of files to live in just 573MB of space, representing the repeating base files between the two containers.
% sudo du -sch /var/lib/lxc/*

560M /var/lib/lxc/base
560M /var/lib/lxc/clone
1.1G total
You can now start the new clone container, connect to it and begin making changes.
% sudo lxc-start -d -n clone
% ssh ubuntu@clone.local

Conclusion

I have been using this setup for the past few weeks, currently with a half-dozen containers that I use for a variety of jobs: testing TileStache, installing Rails applications with RVM, serving Postgres data, and checking out new packages. One drawback that I have encountered is that as the disk image grows, my nightly time machine backups grow considerably. The Mac host OS can only see the Linux disk image as a single file.
On the other hand, having ready access to a variety of local Linux environments has been a boon to my ability to quickly try out ideas. Special thanks again to Seth for helping me work through some of the networking ugliness.

Further Reading

Tao of Mac has an article on a similar, but slightly different Virtualbox and LXC setup. They don’t include the promiscuous mode setting for the second network adapter, which I think is why they advise using Avahi and port forwarding to connect to the machine. I believe my way here might be easier.
Shift describes a Vagrant and LXC setup that skips Avahi and uses a plain hostnames for internal connectivity.

The Owner of this post is Michal Migurski
Find is Blog here http://mike.teczno.com/notes/disposable-virtualbox-lxc-environments.html 

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 10 July 2013

    Manually uninstalling VMware Workstation from Linux hosts

    Manually uninstalling VMware Workstation from Linux

    VMWare Workstation doesn't ship in a deb, so it isn't registered in dpkg (which is why you can't find it in the software center). It does have an install and uninstall utility though.

    To uninstall VMWare Workstation, you will need to run


    #vmware-installer --uninstall-product vmware-workstation
    
    
    

    Details

    This article provides steps for manually removing VMware Workstation when the uninstaller script or RPM package fails to remove the product automatically.

    Solution

    Note: Log into the host using the root account to execute the terminal commands in this article. If running Ubuntu, the root account is not available by default. Prepend all commands with sudo,or switch to root using this command:

    sudo su -

    Warning: This command provides unrestricted access to the operating system. It is possible to cause damage to the system when using this access level.

    1. Open a command prompt. For more information, see Opening a command or shell prompt (1003892). Type the commands as indicated in the steps of this procedure.
    2. Shut down all VMware applications and services.

      /etc/init.d/vmware stop

    3. Verify that all processes have stopped:

      lsmod | grep vm

      Note: A zero must be listed beside VMware related modules to indicate that they are no longer running.

    4. Move the VMware libraries to the /tmp directory:

      cd /lib/modules/kernel_version/misc
      mv vm* /tmp


      Note: If the kernel has ever been updated, you must check and move the files from multiple paths. Substitute the kernel version where indicated above.

    5. Unload the kernel modules:

      rmmod vmnet.o
      rmmod vmmon.o
      rmmod vmci.o
      rmmod vmblock.o
      rmmod vmppuser.o


    6. Remove the VMware startup scripts:

      RedHat and Most Distributions:
      rm /etc/rc.d/init.d/rc2.d/*vmware*
      rm /etc/rc.d/init.d/rc3.d/*vmware*
      rm /etc/rc.d/init.d/rc5.d/*vmware*
      rm /etc/rc.d/init.d/rc6.d/*vmware*


      Ubuntu:

      rm /etc/rc2.d/*vmware*
      rm /etc/rc3.d/*vmware*
      rm /etc/rc5.d/*vmware*
      rm /etc/rc6.d/*vmware*


      Note: If you are using a different Linux distribution, substitute the correct path in the commands.

    7. Remove the remaining VMware files and directories:

      rm -rf /etc/vmware*
      rm /usr/bin/vmware-usbarbitrator
      rm /usr/bin/vmnet*
      rm -r /usr/lib/vmware*
      rm -r /usr/share/doc/vmware*


    8. If an RPM package was used to install the VMware product, complete these steps to delete the RPM database entry:

      rpm -qa | grep VMware

      A list of VMware packages is presented. Copy the exact package name for the next step and paste it into the command where indicated.

    9. Remove the VMware packages:

      rpm --erase --nodeps VMware_Package_Name

    Friday 21 June 2013

    Monday 13 May 2013

    How to Upgrade Wine from the Older version to Wine1.5 on uBuntu

    I am new to Wine and anything like it. I want to run the application "ATCS Monitor". When I installed ATCS Monitor I received an error message:

    C:\windows\system32\wshom.ocx

    Unable to register the DLL/OCX: RegSvr32 failed with exit code 0x1

    -From Terminal-

    err:typelib:sltg_get_typelib_ref Unable to find reference
    err:module:import_dll Library ScrRun.dll (which is needed by L"C:\\windows\\system32\\wshom.ocx") not found


    I can get through it by just ignoring it but I then have errors in ATCS Monitor.

    First, upgrade to Wine 1.3.35. Wine 1.2.3 is almost a year old and is 
    missing some very important updates. 

    Second, do a search for the file in the directory $HOME/.wine I suspect 
    that either it is not there or it is in the same directory as where the 
    program installed. ...


    Ubuntu and Ubuntu derivatives (such as Kubuntu) obtain software from packages which are stored in repositories. Ubuntu's default repository includes Wine, however if you want to stay up to date with the latest Wine package you can use WineHQ's by following these instructions.

    Adding the WineHQ PPA Repository:

    Open the Software Sources menu by launching the Ubuntu Software Center and selecting Edit->Software Sources. Choose the Other Software tab and click Add.
    Software Center->Edit->Software Sources->Other Software
    Then, copy and paste the line below.
    ppa:ubuntu-wine/ppa

    Warning: Beta packages

    The 1.5 packages here are beta packages. This means they will periodically suffer from regressions, and as a result an update may break functionality in Wine. If the stable 1.4 Wine version works for you, then you may not want to use these beta packages.

    Installing Wine:

    Once you have added the WineHQ PPA Repository, you are ready to install.
    To get the most recent Wine 1.5 beta, click this link to install the wine1.5 package.
    To install the older, stable Wine 1.4 version, click this link to install the wine1.4 package.

    Upgrading to a new version of Ubuntu

    If you are upgrading the entire system, such as going from Ubuntu 11.10 to 12.04, you will need to come back to this page and add the repository again. The built in update manager will not switch the Wine repository automatically.

    Alternative Command Line Instructions for Installing Wine:

    It is also possible to add the Wine PPA and install via the terminal. This may be useful on Kubuntu, Xubuntu, and other Ubuntu derivatives.
    sudo add-apt-repository ppa:ubuntu-wine/ppa
    Then update APT package information by running 'sudo apt-get update'. You can now install Wine by typing 'sudo apt-get install wine1.5'.
    If you'd like to browse the PPA manually, you can visit its Launchpad page.

    Thursday 4 April 2013

    HOW TO Solve issue Nvidia & X.org Server Problems on Linux or BackTrack5


    1. I spent a week trying to resolve the error generated by X.org Server and Nvidia drivers, and I think I've finally solved.
      This is the solution for my Nvidia GT540M & Intel i7-2670QM (ASUS X53SV-SX598V)
      1. Download NVIDIA driver from here: http://www.nvidia.com/object/unix.html.
      I use Linux x86_64/AMD64/EM64T (NVIDIA-Linux-x86_64-285.05.09.run) for my system at 64bit
      2. Install system updates
      Code:
      sudo apt-get update && sudo apt-get upgrade
      3. Install linux-header to the upgraded kernel
      Code:
      sudo apt-get install linux-headers-$(uname -r)
      4. If dkms and build essential haven't been installed
      Code:
      sudo apt-get install dkms build-essential
      5. Open blacklist.conf file to add some lines (I use vi command)
      Code:
      vi /etc/modprobe.d/blacklist.conf
      6. Press i and after others “blacklist” list add this list
      Code:
      blacklist vga16fb
      blacklist nouveau
      blacklist rivafb
      blacklist nvidiafb
      blacklist rivatv
      7. After that, press ESC and type :wq (this write the file)
      8. Make grub.cfg writable
      Code:
      chmod +w /boot/grub/grub.cfg
      9. Open grub.cfg file
      Code:
      vi /boot/grub/grub.cfg
      10. Find text splash text inside the document and add nouveau.modeset=0 text like this
      Code:
      text splash nouveau.modeset=0 vga=791
      11. After that, press ESC and type :wq (this write the file)
      12. Disable writable mode to grub.cfg file
      Code:
      chmod -w /boot/grub/grub.cfg
      13. Update grub.cfg file
      Code:
      update-grub‎
      14. Reboot
      15. Login and don’t write startx
      16. Remove all previous Nvidia drivers
      Code:
      sudo apt-get --purge remove nvidia-*
      17. Remove default drivers
      Code:
      sudo apt-get --purge remove xserver-xorg-video-nouveau
      18. Chmod the nvidia driver file
      Code:
      chmod a+x NVIDIA-Linux-x86_64-285.05.09.run
      19. Run the nvidia driver*
      Code:
      sh ./NVIDIA-Linux-x86_64-285.05.09.run
      *If you use a 64bit system don’t install the OpenGL 32bit
      20. Reboot

      If you have a problem like this:
      Code:
       
      X.Org X Server 1.7.6
      Release Date: 2010-03-17
      X Protocol Version 11, Revision 0
      Build Operating System: Linux 2.6.24-28-server x86_64 Ubuntu
      [...]
      Fatal server error:
      no screens found

      It means that the automatic writing of xorg.conf (nvidia-xconfig command) during installation is not successful., but the driver has been installed correctly.
      To solve this problem just delete the xorg.conf file:

      Code:
      rm /etc/X11/xorg.conf
      When you restart the PC the file xorg.conf file will be created automatically.
      Reebot and type
      Code:
      startx
      I hope it helps

    Monday 28 January 2013

    How to remove icons from Top-Taskbar on Gnome


    You are using the Gnome-Classic interface - either you are using this by choice, or you are using the fallback  mode which occurs if your graphics card & driver doesnt the 3D Acceleration required for the full Gnome-Shell GUI.
    To add and remove application launchers in the gnome-panel you need to:


    Press Win+Alt and right-click the top menu bar - N.B. Win is the Windows Symbol key
    If you are not using Compiz then you need to :
    Press Alt and right-click the top menu bar


    Much more information is described in the linked Q&A and other links in that answer.

    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...