Categories
blog Linux Ubuntu VMWare

Centos 7.6 Minimal Post Install Change

I’m working on a project at a customer location this week and this particular project required me to install Centos 7+.  Being an Ubuntu guy, I kicked and moaned for about 3 whole seconds and started the install.  It went as smooth as you’d expect, however, I was greeted with no network connectivity once Centos rebooted.  Mentally, I thought it was needing VMWare drivers or something but as it turns out, I just needed to enable the network interface.

vi /etc/sysconfig/network-scripts/ifcfg-<cardname>

Now change ONBOOT=No to ONBOOT=Yes

Then simply reboot and make sure you can get connected to the network.

Categories
blog Linux Ubuntu

bitcoin CPU mining with Ubuntu 12.04

Please do not bother responding with how worthless this is.  This is purely academic.  A few of the guys at my office were curious and I was idle for a little while this weekend and got started with the basics of the basics in bitcon mining.

Prerequisites

Go setup yourself a bitcoin wallet here –> http://www.trybtc.com  There will be some tutorials, feel free to go through those.

You’ll end up here –> https://coinbase.com This is where you can keep track of your account.  First let’s pop in there and grab the bitcoin address that we will use in a bit.  You can find it under Account Settings –> Bitcoin Addresses.  This is how others can give you money.

Create an account here –> https://mining.bitcoin.cz/ This is the only way that CPU mining is even relevant….which it’s really not.  This is a pool of individuals that work on mining bitcoin blocks.

 

Ok, now that you have setup the accounts, here is the basic how-to for setting up CPUMINER on Ubuntu 12.04 Server.  I have this deployed on 16 VM’s running 1 processor and 512 Megs of RAM each for testing.

Install Ubuntu 12.04 Server and get root

wget https://s3.amazonaws.com/clamasters/linked/bcminingprep.sh
chmod o+x bcminingprep.sh

edit bcminingprep.sh for your worker user/pass found under “My Account” in the bitcoin.cz site.

./bcminingprep.sh
./mine.sh

Now you are mining.  Please feel free to comment how fast or slow your mining is going.  I have 16 VM’s on modern hardware under XenServer 6.2 running on AMD processors all getting 4.57 khash/s.  Please note…this is very slow and you will likely never make your money back once power is concerned.

If you want to learn more about bitcoin and bitcoin mining, here are 2 links that I found to be helpful.  http://www.reddit.com/r/bitcoin and http://www.bitcoinmining.com.

Categories
blog Linux Ubuntu

Apache2 on Ubuntu – OpenSSL CSR / Self Signed Cert

Seventy-five percent of the servers I have been working on over the last few months have been Linux.  Mostly Ubuntu.  This due to the fact that my company has allow me to start migrating over and building new servers on this platform.  With that, we need secure ways to access the servers.  On occasion I’ll use webmin but mostly just SSH and whatever website is running on it (management, applications, etc).  Webmin takes care of itself with a self signed certificate and SSH creates its own keys.  Pretty easy there.  Now, for the website that is running on the box, out of the gate it’s unencrypted TCP/80 traffic running from an Apache 2 web server.  This short tutorial will cover how to create a CSR with OpenSSL for use when getting a certificate from one of the CA’s.  I won’t explain everything here but you may use Ubuntu’s https-help guide if you need more info found here.

First, let’s make sure we have the right packages installed.

apt-get install openssh apache2 apache2.2-common php5

Now let’s enable SSL for apache2

sudo a2enmod ssl

Now lets create the server SSL key.

cd /etc/ssl/private
openssl genrsa -des3 -out dns.server.com.key 1024

Ok, now that we have the key, let’s create the CSR to be given to the CA.

openssl req -new -key dns.server.com.key -out dns.server.com.csr

It will prompt you for the passphrase and some other bits of information.  The most important one is site name.  This must match the name of your server.  Something like mail.domain.com or www.domain.com would be appropriate here.

The CSR can now be uploaded to whatever CA you choose.  I use GoDaddy because they are so cheap.

If you do not want to purchase a certificate you can create your own self signed cert with the following command.

openssl x509 -req -days 365 -in dns.server.com.csr -signkey dns.server.com.key -out dns.server.com.crt
cp /etc/ssl/private/dns.server.com.crt /etc/ssl/certs

Now that we have the cert created, let’s configure Apache to use it. Add the following 3 lines to your website configuration.  The default one is located in /etc/apache2/sites-available/default.

SSLEngine on
SSLCertificateFile /etc/ssl/certs/dns.server.com.crt
SSLCertificateKeyFile /etc/ssl/private/dns.server.com.key

Save that config file and enable Apache to listen on 443 for HTTPS traffic.  Add the following line to /etc/apache2/ports.conf

Listen 443

Restart your Apache2 process and you should have a fully functional SSL enabled website.

/etc/init.d/apache2 force-reload && /etc/init.d/apache2/restart

Categories
blog Linux Ubuntu

60 second vi intro

vi is neat.  Most of the engineers I work with like nano or pico but I like vi.  For some reason it makes me feel more like a geek when I’m using it.  In fact, I’ve been using it so often lately that I have been trying to use vi command in notepad (obviously without success).  This tutorial will cover only the basics but that should be enough to get you started.  A much better tutorial is available here.

vi /etc/network/interfaces - opens /etc/network/interfaces in vi

i - insert
/ - search
G - [Shift] g - go to bottom of page
dd - delete the line
d <- or d -> - d [left or right arrow] delete 1 character in that direction
10G - 10 [Shift] g - move to line 10 (obviously number can be replaced)
10dd - delete 10 lines from cursor and below (again, number can be changed)
:q - quit (no changes may have been made)
:q! - quit (do not save changes)
:wq - write quite (save and quit)
:w - write (save)

Ok, now that you have mastered the basics of vi, please refer all other needs to the link provided above.  Hope you like vi as much as I do.

NOTE:  Ubuntu (and maybe debian) have a few things that the built in vi program have that seem a little strange.  I usually install vim just to be safe.  to do this run sudo apt-get install vim-full.

Categories
blog Ubuntu

Ubuntu – Prevent a package from being updated

The original post for this is from the Ubuntu Geek website but I learned something new from it so I thought I would share my new favorite way to keep a package from being updated in Ubuntu.  This goes for pretty much any of the newer releases of Ubuntu.  I used to use dpkg to do this but now I like aptitude much better.  It’s easier for me.

To put a package on hold use this command.

sudo aptitude hold snort-mysql

To remove the hold use this command.

sudo aptitude unhold snort-mysql

To keep your entire system (I think) from being updated simply use this command.

sudo aptitude hold

And to remove the hold use this command.

sudo aptitude unhold

Very easy isn’t it.  Yep, that’s what I thought. I’ll be able to deploy appliances in the field now without worrying if an update is going to break something before I get a chance to fix the issue.