Enough Mac, welcome Linux

Some of you may know that I used MBP for laptop (and I loved it for a long time). But recently I just needed linux locally, I just needed ports. Basically how I solved the problem – bought an old thinkpad x230. Currently, it’s a shitty machine – i5-3320M @ 2.60GHz, 4 gigs of RAM and hdd (don’t even know how big it is).

So, in order to solve the shitty part I am about to “slightly” upgrade it.

  1. Of course remove the hdd and put some nice SSD. Probably samsung evo.
  2. With some hacks and more money – 16 GB of RAM. It is achievable with specific memory (definitely not the valued one) and eventually flashing the BIOS. I know .. “why dual core and 16gb ram?” .. well cuz … I can and I will. + i love having VMs, not only fancy containers.
  3. I have absolutely no freakin idea how this stock battery performs but I have no intention to find out. 9-cell battery is on the way. I expect from it 5-6 hours.

And of course, the x230 is running openSUSE Leap 15. You know me, I love the gekko.

openSUSE Bulgaria с kickstart във VarnaLab!

Наскоро бях загатнал за openSUSE Bulgaria и нашата първа презентация ( so called ) ще бъде във VarnaLab, което е местният hackerspace. Събитието носи име “Въведение в света на openSUSE” и главен ( надявам се не единствен ) лектор ще е Димитър Захариев.

Надявам се и аз да мога да присъствам, а защо не и да взема участие. Относно локацията на събитието и VarnaLab: ул. “Пенчо Славейков” 50, 9000 Варна, център. Датата е 22 април, неделя, а timeframe-ът е 10:30 – 12:00.

Линк към събитието: https://www.facebook.com/events/610885045928276

“Събитието е отворено за всички, които искат да научат повече за света на GNU/Linux и дистрибуцията SUSE/openSUSE. По време на лекцията ще представим SUSE/openSUSE екосистемата, специфики на openSUSE дистрибуциите и демонстрация на някои от нещата”

Очакваме ви!

How to add Skype account to pidgin?

Unfortunately, I have couple of Skype accounts. And I desperately wanted to combine them all in one messenger. That’s where the idea of Pidgin came up. But of course nothing on this world is easy for me. I had to manually add Skype plugin for pidgin in order to add my accounts.

Here are the steps:

  1. Kill all running pidgin proccesses
  2. sudo apt-get install libglib2.0-dev libjson-glib-dev libpurple-dev
  3. git clone git://github.com/EionRobb/skype4pidgin.git
  4. cd skype4pidgin/skypeweb
  5. make
  6. sudo make install

Then start Pidgin. When you try to add new account to Pidgin you will find Skype (HTTP) there waiting for you.

How to send array values by mail

I had a case where I had a pool of servers. And I wanted email notifications if any server or some of them meet the condition. The condition was if my rsync exceeds X number of files, send me a mail. The problem came in the moment when only 1 server met the condition but I received mails for all of them. It was annoying, spamming and WRONG.

The example I am going to show you does NOT include the rsync part because it is simply useless but you will see simulation with a predefined value.

 

#!/bin/bash
set -x

pool=”s1 s2 s3″
emptyvar=””
sendmail=false

number=”6″

for HOST in $pool; do
emptyvar=”$emptyvar $HOST:”
echo “111111111111”

if [[ $number -eq 5 || $1 == true ]];then
echo “No mail”
else
sendmail=true
emptyvar=”$emptyvar $number”
fi
done

echo “mid”

if $sendmail;then
echo “true”
echo “Test $emptyvar $HOST” | mutt -s “Test” somemail@blah.com
exit 1
else
echo “false”
echo “continue to actual”
fi

echo “END”

How to create ssh tunnels and access locally any remotely hosted services

Wassup y’all,

I want to start off by saying that this is my very first time writing an article of any sort. Thanks to Rosen for letting me write as a guest on his awesome website. Anyhow, I hope you find the information below useful and practical as much as I have. Enjoy!

SSH tunnels

Several months ago, I quit Tech Support and started working as a Sys Admin for a storage company (still learning, there’s a looong way to go…). I knew about the power of SSH before, but on several occasions, I found out that creating SSH tunnels can be super useful and it gives you the freedom to quickly access devices from anywhere you want.
In my particular situation, I have a Raspberry Pi 3 sitting at home, up and running all the time, which I use for pretty much anything that I want to experiment with, whenever I get the chance… That last part is key: I want to be able to access the little gadget whenever I feel like it, and not be restricted by my location or the computer I’m accessing it from.

After I set up proper port forwarding in my home router (check the web if you don’t know how to do that yet, it’s very useful), I had to SSH to my external IP address and the specific port, which would in turn forward that to port 22 on my Raspberry Pi, allowing me to type my password at the prompt. Pretty basic procedure but I wasn’t really happy with the fact that I have to specify and address, a port, and type a password. I wanted to create some sort of an alias which would include all that information. I wanted the process to be as automated as possible, and after quite some time digging around on the web, here are the possible solutions that I found:

Simple SSH with an SSH key

You can always use sshpass and use the -p flag to give the password in the command itself, but this is not very safe, as anybody with access can check the CLI history or the current SSH session process (ps aux | grep ssh) and see the password.

Continue reading “How to create ssh tunnels and access locally any remotely hosted services”

How to install Linux, Apache, MySQL, Python (LAMP server).

Hello, friends!

I decided to start my LINUX series finally. Something that I try to do for a long period of time but I don’t have enough time recently for building LINUX lab and testing it.

This topic is extremely useful for linux beginner, in my opinion. For those who want to raise web server and probably building web applications.

Before we start, we need LINUX distribution installed. I chose UBUNTU 14.04.3 ( DOWNLOAD ME ). I don’t have additional machine for Linux, so I am using VirtualBox ( How to install Ubuntu using VirtualBox ).

After you finish with the installation, start the new Linux machine. Open the Terminal and type:

sudo apt-get update

We are doing this step because we need to sure that everything inside the OS is up to date!

When the update is completed, again in Terminal, type:

sudo apt-get upgrade

The first command is going to update the list of packages and their versions on your machine without going through the process of actually installing them. The second command installs the packages. For this reason, you should always run the update command first and then upgrade.


 

Installing APACHE

First, let’s say stuff about Apache. What is Apache?

Apache is a freely available Web server that is distributed under an “open source” license. Version 2.0 runs on most UNIX-based operating systems (such as Linux, Solaris, Digital UNIX, and AIX), on other UNIX/POSIX-derived systems (such as Rhapsody, BeOS, and BS2000/OSD), on AmigaOS, and on Windows 2000. According to a Netcraft (www.netcraft.com) Web server survey 60% of all Web sites on the Internet are using Apache (62% including Apache derivatives), making Apache more widely used than all other Web servers combined.

Why I am choosing Apache?

Simply because it’s the world’s most popular web server software, it’s extremely stable, it’s well-supported, and it’s completely open source, which means you don’t have to pay anything for it. Pretty good reasons 🙂

So .. Again in your Terminal, type:

sudo apt-get install apache2

In order to verify that the installation completed successfully, open your web browser and type http://localhost.

itworks

You should be able to see “It works!”

 


To be sure that Apache and Python will work together we need some additional tools to make this happen. This special tools are called mod_wsgi and python-setuptools. In your Terminal type:

sudo apt-get install python-setuptools libapache2-mod-wsgi

After the installation is completed we need to restart the apache service:

sudo service apache2 restart


 

Installing MySQL

Basically, all you need to know for now is that you need database system. You have two choices here – MySQL / PostgreSQL. In this guide we will review MySQL but I will let you know about both.

MySQL is the more common of the two. It’s relatively easy to install and get working. It’s also very well-supported by third-party tools, as well as by most web hosts. And it’s an extremely fast tool due to the fact that it doesn’t implement the full SQL standard, or as many data types as other solutions (in particular: PostgreSQL). This makes MySQL a great tool to use when writing simple applications that run fast and are easy to set up, but that don’t need to do anything too complex.

PostgreSQL, on the other hand, is a SQL-standards-compliant tool that supports many more data types than MySQL. It’s extremely powerful, and it’s designed to power complex applications. You can achieve much more in PostgreSQL than you can using MySQL. However, PostgreSQL is a bit more complicated to set up, and it’s comparatively less performant for simple operations due to its large feature set.

To install MySQL use the following command:

sudo apt-get install mysql-server

During the installation a pink windows will pop-up asking for your password. Enter it, then verify it. Otherwise the installation won’t continue. When the installation is done, that’s how you log in:

mysql -u root -p

mysqllogin

You can see that I am logged in the SQL server after entering my password the prompt changed to “mysql>”. This means that we are entering commands to the SQL server not the Linux. In order to leave the SQL server, type “exit”:

bye


 

Installing Python

The last step is installing Python. Since Ubuntu is our Linux distribution of choice, we have the luxury of having Python automatically installed for us. If you are curious about what version is currently installed, simply type this command into the Terminal:

python

Similar to the SQL server we are in Python “mode”.helloworld

I wrote the simpliest program just to show you 🙂 You can see that there is also a compiler in the packet. It’s pretty good, indeed!


 

That’s was all required for having a LAMP server. I will continue with my Linux articles soon!