Posts in Category: uncategorized


Linux – How to build an RPM package

To do this, you need to use the rpmbuild command.

First you have to install this utility by installing the following package:

$ yum install rpmdevtools

And maybe also the following too:

$ yum install gcc make rpm-build patch
# the following I think are optional:
$ yum pcre-devel openssl-devel rrdtool-devel

You might need to do some patching:

$ patch -p1 --dry-run < /path/to/patch.patch
$ patch -p1 < /path/to/patch.patch

For more info about checkout out:

7 Patch Command Examples to Apply Diff Patch Files in Linux

$ yum info patch
Loaded plugins: rhnplugin, security, ulninfo
*Note* Spacewalk repositories are not listed below. You must run this command as															

bundle exec rake lint/validate/spec/beaker

befor you run a spec test, you first have to run:

bundle install

This will download all the dependencies (i.e ruby gems).

Then you do:

 

bundle exec rake {task}

 

This in parts means:

bundle exec – “execute the following script using the gems specified in the gemfile”

This in turn executes:

rake {task}

Here since we are calling rake it means that rake calls the rakefile, as a script, and it passes the “{task}” as an input parameter. This input parameter can take any of the following values:

  • lint                     – check for good formatting, e.g. code is properly indented
  • validate   – checks for syntax error
  • spec         – runs the rspec tests (unit tests)
  • beaker   – runs the beaker tests (acceptance tests, also written in rspec).

 

If you want



Cucumber – getting started

Cucumber runs on top of “ruby on rails” (ror). To install ror, go to:

http://railsinstaller.org/en

Now set the path variable:
in cmd you do:
path=%path%;C:\RailsInstaller\Ruby1.9.3;C:\RailsInstaller\Ruby1.9.3\bin

in powershell you do:
$env:path=”$env:path;C:\RailsInstaller\Ruby1.9.3;C:\RailsInstaller\Ruby1.9.3\bin”

Now we create a folder to house all our rails projects e.g.:

mkdir RailsProjects

Now within this directory you create your first project:

PS C:\Users\Mir\RailsProjects> rails new cucumberproject1

This will create a new folder by this name and within this folder it will contain the project files.

next, cd into the project and install the relevent gems using the gemfile.conf file, insert the following at the bottom of the file:

group :CucumberGems do
	gem 'cucumber-rails'
	gem 'database_cleaner'
end

Next, while in the project folder, run:

install bundler

this will read the gemfile and download the specified gems. note you need internet connection for this because it downloads gems from the internet


vsphere – puppet and powershell, and Powercli

https://www.google.com/search?hl=en-GB&ie=UTF-8&source=android-browser&q=powershell+vsphere&gfe_rd=cr&ei=FyQPVKX_Je3H8gft84CwAg&gws_rd=ssl

https://www.google.co.uk/search?hl=en-GB&ie=UTF-8&source=android-browser&q=puppet+vsphere&gfe_rd=cr&ei=SiQPVMjDIu3H8gft84CwAg&gws_rd=ssl

https://www.google.co.uk/search?q=vsphere+command+line&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&channel=sb&gfe_rd=cr&ei=PGQPVMfrBO3H8gft84CwAg


linux – telnet

telnet comes in 2 parts,

 

– telnet (client)

– telnet-server (daemon, that will by default listen on port 23)

 

How to Install Telnet in CentOS / RHEL / Scientific Linux 6.4

 

Telnet is also really useful to check if a certain port on a remote machine is open, here’s the format:

$ telnet {ip number} {port number}

For example, to check port 22, we do:

telnet 192.168.52.201 22
Trying 192.168.52.201...
Connected to home-directories.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1

This shows port 22 is open, whereas if we check a port that is closed, e.g. in my case 21, then we get:

[root@openldap-client01 ~]# telnet 192.168.52.201 21
Trying 192.168.52.201...
telnet: connect															

Linux – Give your Linux machine a hostname and domain-name

When you build a brand new linux machine, you machine will not have a name. As a result, your router (i.e. network) will instead refer to your machine by it’s mac-address:

Now you can assign a name for your hostname using the hostname command, like this:

[root@localhost ~]# hostname PuppetMaster.MayfieldRoad.net
[root@localhost ~]# hostname
PuppetMaster

Here, I’ve called my machine “PuppetMaster”, which is the hostname. I also set the domain name as “MayfieldRoad.net”,

which you can confirm like this:

[sher@PuppetMaster ~]$ hostname --domain
MayfieldRoad.net

Note, the above won’t work, unless you have set “MayfieldRoad.net” as your domain on your router. You can set the domain up in your router, by logging into your router’s web console, and change the


Chromecast – Access another countries Netflix

Take the following instructions:

https://gist.github.com/epeli/9789586 (i only created the script not the dnsmasq)

http://asuswrt.lostrealm.ca/download

http://asuswrt.lostrealm.ca/screenshots

http://asuswrt.lostrealm.ca/sites/default/files/pictures/dhcp.png
you can access above screenshot here:
http:///Advanced_DHCP_Content.asp


Linux – Accessing the linux terminal

The way you access the   linux command line terminal, depends on the scenario:

Scenario 1 – Access your Linux desktop machine’s terminal

Using the gnome ui, interface, simply go to:

Useful Tip: you can create a desktop shortcut to save time.

Scenario 2 – Access a remote linux server’s   terminal from a windows desktop machine.

In most corporate workplaces, linux servers are locked away in server rooms. In these cases, you can access the server’s terminal remotely by using a software called putty. Putty creates a connection to the linux server and opens up a virtual terminal. After that you can use this terminal just as if you were access the linux server directly.

Useful Tip: In a corporate workplace, you may need to remotely connect to several remote linux machines. Then you might