How to fix W: Duplicate sources.list entry http://apt.newrelic.com/debian/ newrelic/non-free amd64 Packages (/var/lib/apt/lists/apt.newrelic.com_debian_dists_newrelic_non-free_binary-amd64_Packages)

How to fix this error ?

W: Duplicate sources.list entry http://apt.newrelic.com/debian/ newrelic/non-free amd64 Packages (/var/lib/apt/lists/apt.newrelic.com_debian_dists_newrelic_non-free_binary-amd64_Packages)

This comes on my hosting once you typed in apt-get update.

The resolution is pretty simple if you know where to look to for and they don’t make it easy.

Instead of navigating to

$cd /etc/apt/

you need to navigate to:

# cd /etc/apt/sources.list.d/ and edit newrelic file

it might just simpler to type:

$vim /etc/apt/sources.list.d/newrelic.list

and edit to file from:

deb http://apt.newrelic.com/debian newrelic non-free

deb http://apt.newrelic.com/debian newrelic non-free

So you need to remove one line and run apt-get update again.

Problem solved!

Or simply you can use this command to find where it is

grep -rnw /etc/ -e “deb http://apt.newrelic.com/debian”
/etc/apt/sources.list.d/newrelic.list:1:deb http://apt.newrelic.com/debian/ newrelic non-free

Advertisements

yum install error File “/usr/bin/yum”, line 30 except KeyboardInterrupt on Cent OS Ubuntu Linux Mint Redhat

This is a common problem if you updated your python distribution to python 3. Normally installed python from source.

 

Unfortunately yum still depend on the python 2

What you need to do is:

$which python

Then navigate normally to:

$cd /usr/bin/

$ll | grep python

and see what is happening:

lrwxrwxrwx    1 root root           9 Feb 22 17:10 python -> python2.6
lrwxrwxrwx    1 root root           6 Nov  9 12:04 python2 -> python
-rwxr-xr-x    1 root root        9032 Jul 10  2013 python2.6

In my case I have already fixed this problem so you can see that my symlink python -> python2.6

if it point to something else then you need to type in:

ln -s python2.6 python

You can use any other version of python you have got installed as long as it is version 2

 

Install rvm Ruby on Rails and Ruby on Kali Linux

It’s not as simple as described on the rvm website. By some reason it’s just does not work on Kali Linux.

1. Clean up your system first

$apt-get autoremove

2.whereis ruby – we will install a new version and overwrite the existing version instead of removing it.

ruby: /usr/bin/ruby /usr/lib/ruby /usr/bin/X11/ruby /usr/share/man/man1/ruby.1.gz

If you still want to remove it by any reason then you can use these commands if you want but it’s not recommended ;). Try do $apt-get remove ruby

If ruby are installed from source then you need to do the following to remove them.

rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem

3. apt-get install build-essential zlib1g zlib1g-dev libreadline6 libreadline6-dev libssl-dev

This is for root user installation.

$\curl -L https://get.rvm.io | bash -s -- --ignore-dotfiles --autolibs=0 --ruby

Searching for binary rubies, this might take some time.
No binary rubies available for: debian/Kali_Linux_1/x86_64/ruby-2.1.0.
Continuing with compilation. Please read ‘rvm help mount’ to get more information on binary rubies.
Installing Ruby from source to: /home/ami/.rvm/rubies/ruby-2.1.0, this may take a while depending on your cpu(s)…
ruby-2.1.0 – #downloading ruby-2.1.0, this may take a while depending on your connection…
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 11.4M  100 11.4M    0     0   397k      0  0:00:29  0:00:29 –:–:–  968k
ruby-2.1.0 – #extracting ruby-2.1.0 to /home/ami/.rvm/src/ruby-2.1.0.
ruby-2.1.0 – #applying patch /home/ami/.rvm/patches/ruby/2.1.0/changeset_r44327.diff.
ruby-2.1.0 – #applying patch /home/ami/.rvm/patches/ruby/GH-488.patch.
ruby-2.1.0 – #configuring…………………………………………….
ruby-2.1.0 – #post-configuration.
ruby-2.1.0 – #compiling…………………………………………………………………………..
ruby-2.1.0 – #installing……………………………
ruby-2.1.0 – #making binaries executable.
ruby-2.1.0 – #downloading rubygems-2.2.2
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  404k  100  404k    0     0   707k      0 –:–:– –:–:– –:–:–  884k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.0 – #extracting rubygems-2.2.2.
ruby-2.1.0 – #removing old rubygems.
ruby-2.1.0 – #installing rubygems-2.2.2……………
ruby-2.1.0 – #gemset created /home/ami/.rvm/gems/ruby-2.1.0@global
ruby-2.1.0 – #importing gemset /home/ami/.rvm/gemsets/global.gems

This will install latest ruby 2.1.0 in writing this post.

root@amiOs:/home/ami# source /etc/profile.d/rvm.sh
root@amiOs:/home/ami# type rvm | head -n 1
rvm is a function

Yes it’s installed correctly!

This is quite important

root@amiOs:/home/ami# ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

Ruby is now also installed to the correct version.

Now switch to global and update your gems.

root@amiOs:/home/ami# rvm gemset use global
Using ruby-2.1.0 with gemset global
root@amiOs:/home/ami# gem outdated
bigdecimal (1.2.3 < 1.2.5)
minitest (4.7.5 < 5.2.2)
psych (2.0.2 < 2.0.4)
rake (10.1.0 < 10.1.1)
rdoc (4.1.0 < 4.1.1)
test-unit (2.1.0.0 < 2.5.5)
root@amiOs:/home/ami# gem update

Updating installed gems
Updating installed gems
Updating bigdecimal
Fetching: bigdecimal-1.2.5.gem (100%)
Building native extensions.  This could take a while…
Successfully installed bigdecimal-1.2.5
Parsing documentation for bigdecimal-1.2.5
Installing ri documentation for bigdecimal-1.2.5
Installing darkfish documentation for bigdecimal-1.2.5
Done installing documentation for bigdecimal after 1 seconds
………….

$echo “gem: –no-document” >> ~/.gemrc

This is to speed up gem installation as we don’t need docs files.

We will create a gemset now.

root@amios:/home/ami# rvm use ruby-2.1.0@rails4.0 –create (two dashes this need to be –create instead of -create)

It’s time to install Rails

root@amiOs:/home/ami# gem install rails
Fetching: atomic-1.1.14.gem (100%)
Building native extensions.  This could take a while…
Successfully installed atomic-1.1.14
Fetching: thread_safe-0.1.3.gem (100%)
Successfully installed thread_safe-0.1.3
Fetching: tzinfo-0.3.38.gem (100%)
Successfully installed tzinfo-0.3.38
Fetching: multi_json-1.8.4.gem (100%)
Successfully installed multi_json-1.8.4
Fetching: i18n-0.6.9.gem (100%)
Successfully installed i18n-0.6.9
Fetching: activesupport-4.0.2.gem (100%)
Successfully installed activesupport-4.0.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: builder-3.1.4.gem (100%)
Successfully installed builder-3.1.4
Fetching: actionpack-4.0.2.gem (100%)
Successfully installed actionpack-4.0.2
Fetching: activerecord-deprecated_finders-1.0.3.gem (100%)
Successfully installed activerecord-deprecated_finders-1.0.3
Fetching: arel-4.0.2.gem (100%)
Successfully installed arel-4.0.2

after 658 seconds
27 gems installed
root@amiOs:/home/ami# rails
Usage:
rails new APP_PATH [options]

root@amiOs:/home/ami# rvm gemset list

gemsets for ruby-2.1.0 (found in /home/ami/.rvm/gems/ruby-2.1.0)
(default)
global
=> rails4.0

root@amiOs:/home/ami# rvm gemset use rails4.0
Using ruby-2.1.0 with gemset rails4.0
root@amiOs:/home/ami#

Well done to you?

Think I can improve it? Post your comments!

SSD Hosting for 5 dollars a month https://www.digitalocean.com/?refcode=71a52388956e

How to remove annoying message on Digital Ocean SSD Hosting after droplet creation

The problem. Annoying message every time you are logging in 🙂

* Documentation:  https://help.ubuntu.com/
————————————————————————————-
To finish installing WordPress, navigate to your droplet’s IP: http://xxx.xxx.xxx.xxx
Make sure to specify hostname from DO panel to your droplet before creating it (for example: ‘blog.mydomain.com’ or ‘myblog.com’)
This will create necessary Apache configs based on hostname and Apache will respond based on hostname.
Server will also respond to its IP address, so if you finish installation from http://IP then
you will need to change hostname from WordPress Settings later (from http://IP to http://hostname)
————————————————————————————-

Resolution:

You can use the GREP command to search the content in your files on your system.

-r recursive

-n line number

-w whole word matching

root@amios# grep -rnw /etc/ -e ‘To finish installing WordPress,’

That is the puppy!

File /etc/motd – Line no 2 😉
/etc/motd.tail:2:To finish installing WordPress, navigate to your droplet’s IP

Interested in buying this hosting ?

You can sing up here.

How to fix “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” on Ubuntu Linux

apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
The easier way to fix it is by typing this command:

What it does it created the files called ‘fqdn’ fully qualified domain name and this will fix this error 🙂

root@amios:/# touch /etc/apache2/conf.d/fqdn | echo “ServerName localhost” >> /etc/apache2/conf.d/fqdn

If you want to fix more problems with your apache this is where you can find the logs.

In this way you can find apache logs files. Where they are ? Here 🙂

# grep ErrorLog /usr/local/etc/apache22/httpd.conf
# grep ErrorLog /etc/apache2/apache2.conf
# grep ErrorLog /etc/httpd/conf/httpd.conf

grep: /etc/httpd/conf/httpd.conf: No such file or directory

grep: /usr/local/etc/apache22/httpd.conf: No such file or directory

grep ErrorLog /etc/apache2/apache2.conf
# ErrorLog: The location of the error log file.

For Ubuntu 14+ to the below.

Use a text editor such as “sudo nano” at the command line or “gksudo gedit” on the desktop to create a new file,

$ sudo nano /etc/apache2/conf-available/fqdn.conf

or

$ gksu “gedit /etc/apache2/conf-available/fqdn.conf”

then add

ServerName localhost

to the file, save it, and enable your new configuration file by running the command below.

sudo a2enconf fqdn

This can all be done in a single command with the following:

$ echo “ServerName localhost” | sudo tee /etc/apache2/conf-available/fqdn.conf && sudo a2enconf fqdn

Testing Cheapest SSD Hosting provider DigitalOcean – Real live testing done by myself

Please keep in mind that I cannot take responsibility to testing you are doing on your own PC using this commands.

0. Creating a Droplet which is a Linux distro with some app for example wordpress takes 55second.

0.1 Disk size on 20gb Hosting for 5 dollars is 20480MB

1. Disk Performance

root@amios:/home/ami# hdparm -t /dev/vda

/dev/vda:
Timing buffered disk reads: 614 MB in 3.00 seconds = 204.33 MB/sec

Normal drive has got speed around 50mb/s so Yes it’s an SSD drive indeed.

2. Random access test using seeker programer provided by this website http://www.linuxinsight.com/files/seeker.c

root@amios:/home/ami# gcc -O2 seeker.c -o seeker

root@amios:/home/ami# ./seeker /dev/vda
Seeker v2.0, 2007-01-15, http://www.linuxinsight.com/how_fast_is_your_disk.html
Benchmarking /dev/vda [20480MB], wait 30 seconds…………………………
Results: 7278 seeks/second, 0.14 ms random access time

0.14ms comparing on 5.5ms on normal hard drive is quite good 😉 on 7200rpm hard drive this is around 15ms

3. root@amios:/home/ami# hdparm -tT /dev/vda

/dev/vda:
Timing cached reads: 10882 MB in 2.00 seconds = 5447.41 MB/sec
Timing buffered disk reads: 864 MB in 3.00 seconds = 287.91 MB/sec

4. Another Testing using ‘dd’ command – Copying speed 2.1GB in 12second

root@amios:/home/ami# dd if=/dev/zero of=/tmp/output.img bs=8k count=256k
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 12.4319 s, 173 MB/s

root@amios:/home/ami# rm /tmp/output.img

5. Reading speed MB/s – different method.

root@amios:/home/ami# hdparm -t –direct /dev/vda

6. Writing speed MB/s

DO NOT FORGET CTRL+C after some time and delete the bf file.

root@amios:/home/ami# sync;time bash -c “(dd if=/dev/zero of=bf bs=8k count=500000; sync)”
^C479271+0 records in
479271+0 records out
3926188032 bytes (3.9 GB) copied, 23.3138 s, 168 MB/s

real 0m23.335s
user 0m0.360s
sys 0m14.073s

/dev/vda:
Timing O_DIRECT disk reads: 1318 MB in 3.01 seconds = 437.65 MB/sec

If you are interested in buying their SSD Hosting and would like to support this website then please use the link below.

Many Thanks!!

Would you like to see any more testing done on this hosting ??

Let me know and keep me posted!!

How to change default editor in Ubuntu Linux Mint Debian or any other distrubutions

Welcome and Thank you for your support!
Support this website by leaving Comments

1.VIM – As I prefer Vim always! 🙂

ami@amios:~$ which vim
/usr/bin/vim

ami@amios:~$ export EDITOR=/usr/bin/vim

OR do it by .bashrc

ami@amios:~$ echo “export EDITOR=vim” >> ~/.bashrc
ami@amios:~$ cat .bashrc | grep vim
export EDITOR=vim

Yes 😉

check your env (environment variables)

root@amios:/home/ami# env | grep EDITOR
EDITOR=/usr/bin/vim

2. Nano editor

export EDITOR=”nano”
export VISUAL=”nano”

3. Other options

update-alternatives –config editor