Configure DKIM on Postfix
Here are steps to configure DKIM on Postfix.
I configure DKIM on Postfix using the Ubuntu.
1. Install dkim
sudo apt-get update sudo apt-get upgrade sudo apt-get install opendkim opendkim-tools |
2. Configure /etc/opendkim.conf
Domain yourdomain.com KeyFile /etc/mail/mail.private Selector mail |
3. Configure /etc/default/opendkim file
Add to the end of the file.
SOCKET="inet:8891@localhost" |
4. Configure /etc/postfix/main.cf file
Add these configuration options to the end of the main.cf file.
# DKIM milter_default_action = accept milter_protocol = 2 smtpd_milters = inet:localhost:8891 non_smtpd_milters = inet:localhost:8891 |
5. Create directory /etc/mail and go there with cd
6. Generate keys in /etc/mail
sudo opendkim-genkey -t -s mail -d youdomain.com |
After generating keys you’ll have mail.private and mail.txt in the directory. mail.private is your private key and mail.txt is the public key that you should set as TXT record of the domain.
7. Configure your domain TXT record for DKIM
mail.txt contains what you should set for the domain. It contains something like this:
mail._domainkey IN TXT "v=DKIM1; k=rsa; t=y; p=MIG...QAB" ; ----- DKIM key mail for youdomain.com |
This means that you need to create TXT record for you domain that has mail._domainkey as a “host name” and v=DKIM1; k=rsa; t=y; p=MI…AQAB as a “ip address/url”.
7. Start opendkim and restart Postfix
sudo service opendkim start sudo service postfix restart |
8. Useful links
Short ssh alias to access to remote host via ssh
Often, when I want to access my remote DigitalOcean server I have to find out the IP address of it. It isn’t comfortable for me so I decided to create a short alias for this IP in /etc/hosts. Now, after I’ve just made an alias, it’s really more comfortable and faster to login to the remove server via ssh.
/ets/hosts
127.0.0.1 localhost 127.0.1.1 infous-desktop 69.55.52.184 your_alias |
Login via ssh using the alias
ssh user@your_alias |
UPDATE:
The another way to set the ssh alias is to edit the ~/.ssh/config file.
Host your_alias Hostname 192.0.2.1 |
Then to login just type:
ssh user@your_alias |
But there’s a shorter way. Again, edit ~/.ssh/config and set:
Host your_alias Hostname 66.66.66.66 User your_user |
Now, you can login to your remote host via ssh like:
ssh your_alias |
Thanks to everybody that commented this little note and suggested more elegant solutions!
Configure File Watcher to compile LESS in PhpStorm 6 or WebStorm 6
Hi! In this short article I will provide you how to configure a File Watcher to compile LESS files in PhpStorm 6 or WebStorm 6.
So, first let’s install lessc. It’s a compiler for the LESS CSS meta-language.
sudo apt-get install lessc |
Then open the Project Settings of IDE and find File Watchers there. Then add new Watcher by pressing plus icon and choose LESS. As a Program set /usr/bin/lessc or in your case you can find out the lessc path with the command whereis lessc.

After the configuring the File Watcher you may start to edit LESS files and you’ll get them compiled to CSS immediately.
How to align facebook and twitter buttons in the line
In this note you’ll find some simple css styles that help to align facebook and twitter buttons in the one line.
Here’s the HTML of the buttons:
<!-- facebook --> <div class="fb-like" data-send="false" data-layout="button_count" data-width="100" data-show-faces="true"></div> <!-- twitter --> <a href="https://twitter.com/share" class="twitter-share-button" data-via="user">Tweet</a> |
Here’s the css styles that fixe the alignment:
.fb-like { vertical-align: top; } .fb_iframe_widget span { vertical-align: text-top !important; } |
BTW, I include facebook icon with help of HTML5 method.
How to create user and grant access to database in MySQL
Here is the sample about how to create a MySQL user and grant access to the database. In this example I use mysql command line tool.
First, let’s create a MySQL user:
CREATE USER 'user_name'@'%' IDENTIFIED BY 'user_password'; |
After creating a database user let’s grant access to the database for the created user, so that the user can have all rights on the database:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'user_name'@'%'; |
More info about creating and granting access in MySQL here http://dev.mysql.com/doc/refman/5.5/en/adding-users.html
Install PhpStorm on Ubuntu
I use Ubuntu 11.10 and in this short note I will provide steps to install PhpStorm.
1. Install Java
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer |
And check that Java’s been installed well:
java -version |
Or:
javac -version |
http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
2. Download PhpStorm for Linux. You will download PhpStorm-5.0.4.tar.gz or something like this. BTW, I download it using Google Chrome.
http://wiki.jetbrains.net/intellij/Installing_and_running_PHPStorm_on_Ubuntu
3. Click on the downloaded archive so that Archive Manager will be opened. Extract all files to ~/PhpStorm/ if you don’t have this folder create it.


Don’t uncheck “Re-create folders” and “Overwrite existing files”. Everything should be like on the screenshots above. Otherwise the folder structure will be broken and you might get the error, when you’re launching phpstorm.sh:
Error: Could not find or load main class com.intellij.idea.Main
4. After the PhpStorm archive has been extracted quit the Archive Manager.
5. Open the Terminal and find phpstorm.sh inside ~/PhpStorm/PhpStorm-121.390/bin/ folder and run it:
sudo ~/PhpStorm/PhpStorm-121.390/bin/phpstorm.sh |
Congratulations, PhpStorm should be installed and launched!
Configure Postfix only to send mail
Very often you need to send mail only. For example, your web site sends some notifications by email only. In this case, there’s a reason to configure you MTA (main transfer agent) only to send emails.
In case of Postfix, only some options should be edited to force your Postfix to send mail only.
/etc/postfix/main.cf
inet_interfaces = loopback-only mydestination = |
Comment existing inet_interfaces and mydestination if they’re exist by using # at the beginning of the line.
Don’t forget to reload Postfix:
sudo /etc/init.d/postfix reload |
For more information you may read Postfix on a null client.
How to install Postfix on Ubuntu
Here’s a quick guide of installing Postfix (Mail Transfer Agent) on Ubuntu Linux.
To install Postfix type this command:
sudo apt-get install postfix |
/etc/postfix/main.cf is a main configuration file.
At least, configure a hostname in main.cf.
To find out the value of some configuration option type this command, for example, find out the myhostname value:
postconf -d myhostname |
After all the changes have been made to main.cf you should restart the Postfix to apply the changes:
sudo /etc/init.d/postfix reload |
sendmail command examples
Before all of the things you need Linux and something like Postfix installed. I test these examples on Ubuntu.
In the first example, we will create a file with the message and then we’ll send it to the recipient with help of sendmail command.
Create the file /tmp/mail.txt that contains the text and a new line at the end:
sudo nano /tmp/mail.txt |
Subject: the subject This is the text of the message. [new line] |
Then type this:
sendmail recipient@gmail.com < /tmp/mail.txt |
Ubuntu on Dell Inspiron 15 3520 laptop log
Today I’ve got my Dell Inspiron 3520 laptop with pre-installed Ubuntu Linux. This article contains the log, notes and tips about Ubuntu and this laptop.
Shortly about the hardware configuration:
15.6″ (1366×768) LED / Intel Pentium B960 (2.2 ГГц) / RAM 4 ГБ / HDD 500 ГБ / Intel HD Graphics / DVD+/-RW / LAN / Wi-Fi / Bluetooth / Camera / Ubuntu Linux 11.10 (Oneiric Ocelot)
Dell says that Ubuntu 11.10 is officially supported operating system for this laptop.
Also, before I bought it the list of Ubuntu’s certified hardware had been checked against this notebook. I found out that this laptop is a certified hardware of Ubuntu but it should have pre-installed Ubuntu only.
After starting the laptop, Ubuntu asked some data about me, what city I am, default login/password, etc. Then I have a working operating system out of the box. I like it!
Then I decided to install some updates. To my surprise, there were lots of updates! 20 minutes of updating the system.
1 2 | sudo apt-get update sudo apt-get upgrade |
It’s very interesting for me is it possible to upgrade from 11.10 to Ubuntu 12.04 keeping all the drivers for the laptop. Think, I’ll test this later
The next step, is installing the Chromium form the Ubuntu Software Center. Everything is OK.
Then I needed something like Google Talk on Windows but for Linux. Unfortunately, there isn’t an analog of Google Talk for Linux
But there’re some chat clients that can work almost like Google Talk. I use Empathy Internet Messaging that comes with Ubuntu.
What about hardware, it works good except of fan. The fan is too loud. I’m going to investigate this problem. I have some links where the similar fan problem mentioned:
Ubuntu heating my laptop
Ubuntu noisier than Windows 7
Fan keeps running indefinitely on Ubuntu after system was temporarily hot
February 23
Today I installed Skype form the Ubuntu Software Center. I logged in without any problems. The look of Skype differs from Windows Skype but it works and there isn’t any ads!
Yesterday, I installed Chromium web browser and logged in with my Google account. Today, when I worked with Chromium surprisingly it installed all the browser extensions I have on Windows. All this happened without restarting a browser.
February 28
I’ve just installed DropBox and there’re some my video files in 3gp format. Ubuntu has just downloaded and installed corresponding codecs for watching the video of this format when I clicked to open the video file!
It isn’t the end! I’m going to continue this log.