Debian and Ubuntu server locale and encoding

I recently had «fun» supporting server installation of software that needed locale set properly.

In Debian, you can just use

dpkg-reconfigure locales

and the console GUI will pop up.

In Ubuntu server, you’ll more steps to make^

http://askubuntu.com/questions/89976/how-to-change-the-default-locale-in-ubuntu-10-10-server

https://debian.pro/503

https://help.ubuntu.com/community/Locale

And make full use of UTF, please: http://docs.python.org/2/library/locale.html

Migration off GMail as part of «spring cleaning».

As part of «spring cleaning», Google Reader was scheduled to be shut down.

FBI  is working with “members of intelligence community” to craft a proposal for new Internet spy powers as “a top priority this year.”

Well, I now have a perfect reason to draft my personal roadmap for this year and to list tools I’m going to use.

http://library.linode.com/email/postfix/dovecot-mysql-debian-6-squeeze

http://paul.frields.org/?p=2609

http://paul.frields.org/?p=2616

http://paul.frields.org/?p=2636

http://technosorcery.net/blog/2010/11/21/offline-email-with-gmail-mutt-postfix-and-offlineimap/

MySQL with Django on Debian

First, install MySQL driver for Python:

sudo apt-get install python-mysqldb

Next, modify your config of MySQL: http://dba.stackexchange.com/a/8289

If you’ve already messed up the install, you can either drop/create database from scratch, or apply the following script to every table of your DB:

ALTER TABLE `table` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Alternative mirgation path: http://docs.joomla.org/Convert_a_MySQL_database_to_UTF-8

Latex with ESKDX in Ubuntu

  1. install texlive
  2. install texlive-lang-cyrillic (this will install ukrhyph as well to avoid problems listed in http://people.debian.org/~preining/TeX/TeX-on-Debian/ch2.html#s2.3)
  3. download http://eskdx.org.ua/wiki/
    but it seems to me, that eskdx should already be in cyrillic
  4. copy cp -a eskdx-0.98/unpacked /usr/share/texmf-texlive/tex/latex/eskdx
  5. run sudo texhash
  6. install texlive-latex-extra for lastpage package (190 est.)
  7. install pscyr, as outlined in http://welinux.ru/post/3200/
  8. if you experience difficulties with pscyr, try installing scalable-cyrfonts-tex
  9. install texlive-science for algorithm2e
  10. open /etc/texmf/updmap.d/10texlive-lang-cyrillic.cfg and add line there:
    Map pscyr2.map
  11. run updmap
  12. run updmap-sys
  13. install inkscape gnuplot

UPD 27.01.2014: now I need this installation again and I almost got lost even with this instruction, mainly because of pscyr issues. Now I’m trying to create meaningful instructions for its installation.

Еще я понял, что никому инструкция по установке пакета с кириллическими шрифтами на английском не нужна, поэтому дальше все будет на русском.

Итак, новая инструкция:

а) запустить команды:

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y texlive texlive-lang-cyrillic texlive-latex-extra scalable-cyrfonts-tex texlive-science inkscape gnuplot

б) запустить данный install.sh в директории, куда будут распакованы два архива pscyr:

Зачем менять sh на bash?

Installing Ruby & Ruby on Rails on Ubuntu box

Start by: http://itshouldbeuseful.wordpress.com/2011/05/04/setting-up-ubuntu-11-04-for-rails-development/
Dig deeper with: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
If you install rvm as root and fall in bunch of problems, visit: http://stackoverflow.com/questions/5253643/cannot-install-rvm-permission-denied-in-usr-local-rvm

Symfony2 w/PHP5.3 on Ubuntu 11.04 / Nginx

sudo apt-get install php5
sudo apt-get install php5-suhosin

Nginx.conf:

try_files $uri $uri/ /index.php;
location ~ \.php(/.*)?$ {
 fastcgi_split_path_info ^(.+\.php)(.*)$;
 fastcgi_pass   backend;
 fastcgi_index  index.php;
 fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
 include fastcgi_params;
 fastcgi_param  QUERY_STRING     $query_string;
 fastcgi_param  REQUEST_METHOD   $request_method;
 fastcgi_param  CONTENT_TYPE     $content_type;
 fastcgi_param  CONTENT_LENGTH   $content_length;
 fastcgi_intercept_errors        on;
 fastcgi_ignore_client_abort     off;
 fastcgi_connect_timeout 60;
 fastcgi_send_timeout 180;
 fastcgi_read_timeout 180;
 fastcgi_buffer_size 128k;
 fastcgi_buffers 4 256k;
 fastcgi_busy_buffers_size 256k;
 fastcgi_temp_file_write_size 256k;
 }
 #error_page  404              /404.html;

 location /web/ {
 root /var/www/;
 allow all;
 }

Restart Nginx

ps -ax | grep nginx
kill 1021
sudo /etc/init.d/nginx restart

Install PHP-FPM:

sudo apt-get install php5-fpm
sudo /etc/init.d/php5-fpm restart

Install SqLite:

sudo apt-get install php5-sqlite
sudo /etc/init.d/php5-fpm restart

Install internationalization tools:

sudo apt-get install php5-intl

PEAR for APC:

sudo apt-get install php5-intl php-pear
sudo /etc/init.d/php5-fpm restart
sudo pecl install apc

Add date.datetime for your zone and turn shorthand tag mode off:

sudo vim php.ini

You’re done!

sudo /etc/init.d/php5-fpm restart

XeTex в Ubuntu 11.04

Установка:

sudo apt-get install texlive scalable-cyrfonts-tex
sudo apt-get install texlive-xetex

Документ:

\documentclass[11pt]{article}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Ubuntu}
\begin{document}
\section{Unicode support}

\subsection{English}
All human beings are born free and equal in dignity and rights.

\subsection{?slenska}
Hver ma?ur er borinn frj?ls og jafn ??rum a? vir?ingu og r?ttindum.

\subsection{Русский}
Все люди рождаются свободными и равными в своем достоинстве и
правах.

\subsection{Ti?ng Vi?t}
T?t c? m?i ng??i sinh ra ??u ???c t? do v? b?nh ??ng v? nh?n ph?m v?
quy?n l?i.

\subsection{????????}
???? ?? ???????? ??????????? ????????? ??? ???? ???? ???????????
??? ?? ??????????.

\section{Legacy syntax}
When he goes—«Hello World!»\\
She replies—“Hello dear!”
\end{document}

Компоновка:

xelatex xela.tex

Вывод:

xela

Установка Munin и его настройка на nginx

Всегда приятно, когда обо всем знаешь. Даже когда тебе это ни к чему. В мире UNIX инструмент для этого — мониторинг. Реализован он, как правило, с помощью стандартного решения, которое испытано в непростых условиях.
Я выбрал Munin — приложение системного и сетевого мониторинга с веб-панелью.
Он присутствует во всех популярных репозиториях пакетов и не требует дополнительных зависимостей.
Моей целью был мониторинг Nginx. Для этого необходимо пересобрать с флагом —with-http_stub_status_module. Поэтому сначала сделаем это.

Читать далее

Installing MongoDB 1.8.1 on Ubuntu 11.04 and PyMongo

Install everything you need:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo nano /etc/apt/sources.list

Next, add a line to sources.list:

— on Ubuntu

deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen

— on Debian

deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen
sudo apt-get update
sudo apt-get install mongodb-10gen
sudo apt-get install python-setuptools
sudo easy_install pymongo

Next, test the connection:
Читать далее

Ruby on Rails 3 installation on Debian 6 Squeeze

apt-get install libsqlite3-dev curl git build-essential zlib1g-dev libssl-dev
bash << ( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
rvm install 1.9.2
rvm --default ruby-1.9.2
gem install rails
rails new testapp

в $HOME/.profile

export PATH=$PATH:/var/lib/gems/1.8/bin

comment out sqlite deps in Gemfile
then run rails server

UP 02.03.2012 obsolete replacement:

Package libreadline5-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libreadline-gplv2-dev lib64readline-gplv2-dev

Important note for Ubuntu:

https://rvm.beginrescueend.com/integration/gnome-terminal/

gem install therubyracer
apt-get install libsqlite3-dev

Sun JAVA JDK 6 on Debian 6 Squeeze as default

Some software, as IDEs are demanding Sun JRE instead of any other implementation. That happens due to swing and performance problems unsolved in opensource editions.

On Debian, add non-free in sources.list like
deb http://ftp.ua.debian.org/debian/ testing main contrib non-free

next, after running apt-get update, install java:
apt-get install sun-java6-jdk sun-java6-jre libtcnative-1
Читать далее