{"id":170,"date":"2013-11-30T14:00:55","date_gmt":"2013-11-30T16:00:55","guid":{"rendered":"http:\/\/diraol.polignu.org\/?p=170"},"modified":"2013-11-30T14:00:55","modified_gmt":"2013-11-30T16:00:55","slug":"drupal-nginx-varnish-apc-memcache-mariadb","status":"publish","type":"post","link":"https:\/\/diraol.polignu.org\/2013\/11\/30\/drupal-nginx-varnish-apc-memcache-mariadb\/","title":{"rendered":"Drupal + Nginx + Varnish + APC + Memcache + MariaDB"},"content":{"rendered":"

Site do PoliGNU e PoliGen na Digital Ocean (VPS) com Drupal, Nginx, Varnish, APC, Memcache e MariaDB. Tudo isso rodando num Debian Wheezy 7<\/p>\n

Nginx atualizado no Debian Wheezy 7<\/strong><\/p>\n

http:\/\/oskarhane.com\/install-nginx-stable-1-4-1-on-debian-squeeze\/<\/a><\/p>\n

#Start with downloading and installing PGP keys\nwget -O key http:\/\/nginx.org\/keys\/nginx_signing.key && sudo apt-key add key && sudo rm -f key\n\n#Add these lines to \/etc\/apt\/sources.list\ndeb http:\/\/nginx.org\/packages\/debian\/ squeeze nginx\ndeb-src http:\/\/nginx.org\/packages\/debian\/ squeeze nginx\n\n#Update apt lists\nsudo apt-get update\n\n#Upgrade or install nginx\nsudo apt-get upgrade\n#or\nsudo apt-get install nginx\n\nInstalando PHP-FPM<\/strong>\nhttp:\/\/www.ubuntubrsc.com\/instalando-nginx-php-fpm-apc-varnish-mysql-ubuntu-server-12-04.html<\/a>\n\nsudo aptitude install php5-fpm php5-gd php-apc php5-imagick php5-curl php-pear php5-cli php5-common php5-mysql\n\nInstalando o MariaDB (vers\u00e3o 5.5)\nhttps:\/\/downloads.mariadb.org\/mariadb\/repositories\/#mirror=jmu<\/a>\n\n<\/strong>sudo aptitude install python-software-properties\nsudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db sudo add-apt-repository 'deb http:\/\/mirror.jmu.edu\/pub\/mariadb\/repo\/5.5\/debian<\/a> wheezy main'\nsudo aptitude update\nsudo aptitude install mariadb-server\n<\/code><\/pre>\n

Instalando o Varnish<\/h3>\n
https:\/\/www.varnish-cache.org\/installation\/debian<\/a>\n<\/code><\/pre>\n
    \n
  1. curl http:\/\/repo.varnish-cache.org\/debian\/GPG-key.txt | apt-key add -<\/code><\/li>\n
  2. echo \"deb http:\/\/repo.varnish-cache.org\/debian\/ wheezy varnish-3.0\" >> \/etc\/apt\/sources.list<\/code><\/li>\n
  3. aptitude update<\/code><\/li>\n
  4. aptitude install varnish<\/code><\/li>\n<\/ol>\n

    Configurando e fazendo os servi\u00e7os se comunicarem<\/h3>\n
    \nConfigura\u00e7\u00e3o do \/etc\/varnish\/default.vcl\nhttp:\/\/www.lullabot.com\/blog\/article\/configuring-varnish-high-availability-multiple-web-servers<\/a>\n<\/code><\/pre>\n
    \nAcertando as configura\u00e7\u00f5es\/permiss\u00f5es das pastas:\nchown -R polignu:www-data <drupal_root_folder><\/code><\/pre>\n
    find <drupal_root_folder> -type d -exec chmod g+s {} \\;<\/pre>\n
    MySQL\/MariaDB small config\nhttps:\/\/raw.github.com\/ottok\/pkg-mariadb\/master\/support-files\/my-medium.cnf.sh<\/a>\n\nOutras refs:\nhttp:\/\/andrewdunkle.com\/how-install-varnish-drupal-7\n<\/a>http:\/\/www.danielmiessler.com\/blog\/handling-redirects-with-varnish-and-nginx<\/a>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

    Site do PoliGNU e PoliGen na Digital Ocean (VPS) com Drupal, Nginx, Varnish, APC, Memcache e MariaDB. Tudo isso rodando num Debian Wheezy 7 Nginx atualizado no Debian Wheezy 7 http:\/\/oskarhane.com\/install-nginx-stable-1-4-1-on-debian-squeeze\/ #Start with downloading and installing PGP keys wget -O key http:\/\/nginx.org\/keys\/nginx_signing.key && sudo apt-key add key && sudo rm -f key #Add these lines … <\/p>\n

    R, dplyr e o Debian Jessie

    Contexto: Estou fazendo o curso “Getting & Cleanning Data” do Coursera. O Curso é orientado à utilização da linguagem de programação R, e há a recomendação que se utilize a biblioteca ‘dplyr’ do R para manipulação dos dados.

    Porém, a versão atual (26/07/2015) da biblioteca dplyr exige a versão 3.2.1 do R, e no debian Jessia (atual versão estável) o R está na versão 3.1.1. Assim, é preciso atualizar a versão do R para se poder utilizar a biblioteca dplyr. Então vamos ao processo de atualização do R e instalação da biblioteca dplyr.

    Atualizando a versão do R

    Para atualizarmos o R precisaremos de um novo repositório de pacotes. Então precisamos adicionar, ao arquivo “/etc/apt/sources.list” a seguinte linha:

    # R PACKAGES
    deb http://www.vps.fmvz.usp.br/CRAN/bin/linux/debian jessie-cran3/

    Este repositório não tem sua chave-pública inserida no repositório de chaves que o Debian utiliza, então precisamos baixar a chave pública para evitar mensagens de erro, fazemos isso com os comandos (executados como usuário root):

    gpg –keyserver keyserver.ubuntu.com –recv 06F90DE5381BA480
    gpg –export –armor 06F90DE5381BA480  | apt-key add –

    Agora basta atualizarmos a versão dos pacotes:

    aptitude update
    aptitude safe-upgrade

    Pronto, agora devemos ter o R já na versão 3.2.1 em nossas máquinas.

    Atualizando pacotes do R

    O próximo passo é atualizar todos os pacotes do R instalados em sua máquina. Para isso, rode o comando abaixo no R ou no RStudio:

    update.packages(.libPaths()[1])

    O pacote dplyr exige uma versão atualizada do pacote Rcpp (>= 0.12), porém a versão disponível no repositório debian é inferior a esta versão. Então precisamos removê-la pelo gerenciador de pacote do debian (apt ou aptitude) e,  em seguida, instalá-la pelo próprio R (que irá buscar a versão mais atual).

    Assim, para desinstalar utilizamos, no console (terminal), o comando:

    aptitude remove -y Rcpp

     E para instalar pelo R, executamos o comando (no console do R):

    install.packages(‘Rcpp’)

    Pronto, agora podemos realizar a instalação do dplyr.

    install.packages(‘dplyr’)

     

    Managing IPython notebook server via systemd: Part-I

    Original Post by Amit on echorand

    Other reference that helped setting up the server: http://thomassileo.com/blog/2012/11/19/setup-a-remote-ipython-notebook-server-with-numpyscipymaltplotlibpandas-in-a-virtualenv-on-ubuntu-server/


    If you are using IPython notebook on a Linux distribution which uses systemd as it’s process manager (such as Fedora Linux, Arch Linux) , you may find this post useful. I will describe a fairly basic configuration to manage (start/stop/restart) IPython notebook server using systemd.

    Creating the Systemd unit file

    First, we will create the systemd unit file. As root user, create a new file /usr/lib/systemd/system/ipython-notebook.service and copy the following contents into it:

    [Unit]
    Description=IPython notebook

    [Service]
    Type=simple
    PIDFile=/var/run/ipython-notebook.pid
    ExecStart=/usr/bin/ipython notebook –no-browser –pylab=inline
    User=ipynb
    Group=ipynb
    WorkingDirectory=/home/ipynb/notebooks

    [Install]
    WantedBy=multi-user.target

    Note that due to the naming of our unit file, the service will run as ipython-notebook. To completely understand the above unit file, you will need to read up a little of the topic. You may find my earlier post useful which also has links to systemd resources. Three things deserve explanation though:

    The line, ExecStart=/usr/bin/ipython notebook --no-browser --pylab=inline specifies the command to start the IPython notebook server. This should be familiar to someone who uses it.

    The lines, User=ipynb and Group=ipynb specify that we are going to run this process as user/group ipynb (we create them in the next step).

    The line WorkingDirectory=/home/ipynb/notebooks specify that the notebooks will be stored/server in/from /home/ipynb/notebooks

    Setting up the user

    As root, create the user ipynb:

    # useradd ipynb

    Next, as ipynb, create a sub-directory, notebooks:


    # su - ipynb
    [ipynb@localhost ~]$ mkdir notebooks
    [ipynb@localhost ~]$ exit

    Starting IPython notebook

    We are all set now to start IPython notebook. As the root user, reload all the systemd unit files, enable the ipython-notebook service so that it starts on boot, and then start the service:


    # systemctl daemon-reload
    # systemctl enable ipython-notebook
    ln -s '/usr/lib/systemd/system/ipython-notebook.service' '/etc/systemd/system/multi-user.target.wants/ipython-notebook.service'
    # systemctl start ipython-notebook

    If you check the status of the service, it should show the following:

    # systemctl status ipython-notebook
    ipython-notebook.service – IPython notebook
    Loaded: loaded (/usr/lib/systemd/system/ipython-notebook.service; enabled)
    Active: active (running) since Sun 2013-09-22 22:39:59 EST; 23min ago
    Main PID: 3671 (ipython)
    CGroup: name=systemd:/system/ipython-notebook.service
    ├─3671 /usr/bin/python /usr/bin/ipython notebook –no-browser –pylab=inline
    └─3695 /usr/bin/python -c from IPython.zmq.ipkernel import main; main() -f /home/ipynb/.ipython/profile_default/security/kernel-6dd8b338-e779-4e67-bf25-1cd238…

    Sep 22 22:39:59 localhost ipython[3671]: [NotebookApp] Serving notebooks from /home/ipynb/notebooks
    Sep 22 22:39:59 localhost ipython[3671]: [NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
    Sep 22 22:39:59 localhost ipython[3671]: [NotebookApp] Use Control-C to stop this server and shut down all kernels.
    Sep 22 22:40:21 localhost ipython[3671]: [NotebookApp] Using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/MathJax.js
    Sep 22 22:40:22 localhost ipython[3671]: [NotebookApp] Kernel started: 6dd8b338-e779-4e67-bf25-1cd23884cf5a
    Sep 22 22:40:22 localhost ipython[3671]: [NotebookApp] Connecting to: tcp://127.0.0.1:51666
    Sep 22 22:40:22 localhost ipython[3671]: [NotebookApp] Connecting to: tcp://127.0.0.1:52244
    Sep 22 22:40:22 localhost ipython[3671]: [NotebookApp] Connecting to: tcp://127.0.0.1:44667
    Sep 22 22:40:22 localhost ipython[3671]: [IPKernelApp] To connect another client to this kernel, use:
    Sep 22 22:40:22 localhost ipython[3671]: [IPKernelApp] –existing kernel-6dd8b338-e779-4e67-bf25-1cd23884cf5a.json

    You should now be able to access IPython notebook as you would normally do. Finally, you can stop the server as follows:


    # systemctl stop ipython-notebook

    The logs are redirected to /var/log/messages:


    Sep 22 22:39:59 localhost ipython[3671]: [NotebookApp] Created profile dir: u'/home/ipynb/.ipython/profile_default'
    Sep 22 22:39:59 localhost ipython[3671]: [NotebookApp] Serving notebooks from /home/ipynb/notebooks
    Sep 22 22:39:59 localhost ipython[3671]: [NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
    Sep 22 22:39:59 localhost ipython[3671]: [NotebookApp] Use Control-C to stop this server and shut down all kernels.
    Sep 22 22:40:21 localhost ipython[3671]: [NotebookApp] Using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/MathJax.js
    Sep 22 22:40:22 localhost ipython[3671]: [NotebookApp] Kernel started: 6dd8b338-e779-4e67-bf25-1cd23884cf5a
    Sep 22 22:40:22 localhost ipython[3671]: [NotebookApp] Connecting to: tcp://127.0.0.1:51666
    Sep 22 22:40:22 localhost ipython[3671]: [NotebookApp] Connecting to: tcp://127.0.0.1:52244
    Sep 22 22:40:22 localhost ipython[3671]: [NotebookApp] Connecting to: tcp://127.0.0.1:44667
    Sep 22 23:05:35 localhost ipython[3671]: [NotebookApp] received signal 15, stopping
    Sep 22 23:05:35 localhost ipython[3671]: [NotebookApp] Shutting down kernels
    Sep 22 23:05:35 localhost ipython[3671]: [NotebookApp] Kernel shutdown: 6dd8b338-e779-4e67-bf25-1cd23884cf5a

    For me, the biggest reason to do this is that I do not have to start the IPython notebook server everytime on system startup manually, since I know it will be running when I need to use it. I plan to explore managing custom profiles next and also think more about a few other things.

    InternetBanking: Banco do Brasil e GNU/Linux

    firefoxbb

    Finalmente encontrei uma solução (não definitiva) para acessar o Banco do Brasil em sistemas GNU/Linux!

    A solução foi testada num sistema operacional Debian Jessie (8), com o Java da Oracle – mais tarde testo com o OpenJDK e retorno aqui se funcionou.

    Não vou ficar explicando os motivos da solução, se alguém quiser mais detalhes sugiro dar uma olhada nos links abaixo que tem bastante informação!

    A solução

    Resumidamente, basta rodar seu navegador pela linha de comando da seguinte forma: Continue lendo “InternetBanking: Banco do Brasil e GNU/Linux”

    InternetBanking: Santander e GNU/Linux

    A você que é correntista do banco Santander e deseja utilizar o InternetBanking em algum sistema operacional GNU/Linux, o “Módulo de Proteção” do Santander não dá suporte ao seu sistema operacional.

    A solução é você ligar na central de atendimento (4004-3535 para quem é de capitais e regiões metropolitanas) e solicitar a inclusão da sua conta corrente numa lista de contas nas quais o módulo de segurança não será exigido. Dessa forma você poderá acessar sua conta via internet banking sem a necessidade de instalação do módulo de segurança.

    Thinkpad X230t – GNU/Linux nele!

    Neste post vou relatar a instalação do Ubuntu (13.10) e do Debian (testing – jessie) no Thinkpad X230t (tablet version). No Debian será utilizada a interface gráfica i3wm.

    Estrutura das partições:

    1 – boot (/dev/sda1) – 1G
    2 – swap (/dev/sda2) – 8G
    3 – UbuntuOS (/dev/sda5) – 15G
    4 – DebianOS (/dev/sda6) – 15G
    5 – Home (/dev/sda7) – 88G

    Configuração do Touchpad (faz com que o movimento seja mais suave):
    https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/1042069

    Referências

    http://www.linlap.com/lenovo_thinkpad_x230t

    http://hughpumphrey.wordpress.com/2013/06/25/debian-on-the-thinkpad-x230/

    https://wiki.debian.org/InstallingDebianOn/Thinkpad/X230/wheezy

    http://ubuntuforums.org/showthread.php?t=2074106

    http://cpbl.wordpress.com/2013/10/24/ubuntu-13-04-and-13-10-on-lenovo-x230x230t-convertible-tablet/

    http://www.ubuntu.com/certification/hardware/201202-10639/

    Instalando o WPI2SVG no debian/ubuntu

    A “caneta digitalizadora” Wacom Inkling exporta por padrão suas digitalizações no formato (binário) WPI.

    Mas também temos disponível um conversor de WPI para SVG. É o WPI2SVG. Para utilizá-lo, primeiramente é preciso instalar em seu sistema operacional o compilador da linguagem de programação GO.

    Neste tutorial iremos abordar a instalação do WPI2SVG no debian/ubuntu.

    Passo 1 – Instalando dependências

    sudo apt-get install bison

    Passo 2 – Configurando variáveis de ambiente da linguagem de programação Go

    Estou supondo que ela será instalada dentro da pasta “dev” na home do usuário.

     mkdir -p $HOME/dev
     export GOROOT=$HOME/dev/go
     export PATH=$PATH:$GOROOT/bin

    Passo 3 – Baixando a versão mais atual da Go Language:

    Baixe o arquivo mais atual para linux (32 ou 64 bits, a depender do seu sistema operacional) aqui.

    Agora descompate o arquivo dentro da pasta “$HOME/dev”. Você pode fazer isso pela interface gráfica ou pelo terminal.

    No caso de fazer isso pelo terminal, navegue por ele até a pasta aonde o arquivo foi baixado e utilize o comando abaixo, substituindo o nome do arquivo pelo nome correto do arquivo que você baixou:

    tar -C $HOME/dev -xzf go1.1.linux-amd64.tar.gz

    Passo 4 – Instalando o WPI2SVG

    Basta digitar o comando abaixo.

     go get -u github.com/godsic/wpi2svg

     

    Pronto, agora tudo já deve estar funcionando.

    Agora basta navegar até a pasta aonde está o arquivo “wpi” baixado da caneta e utilizar, no terminal, o comando “wpi2svg <nome_do_arquivo.wpi>” que ele irá realizar a conversarsão do WPI para SVG e você poderá editar o arquivo no Inkscape.

    Refs:

    http://golang.org/doc/install

    https://github.com/godsic/wpi2svg

    https://digitalexplorations.wordpress.com/2010/12/23/installing-googles-go-programming-language-on-debian-sid/

    Drupal + Nginx + Varnish + APC + Memcache + MariaDB

    Site do PoliGNU e PoliGen na Digital Ocean (VPS) com Drupal, Nginx, Varnish, APC, Memcache e MariaDB. Tudo isso rodando num Debian Wheezy 7

    Nginx atualizado no Debian Wheezy 7

    http://oskarhane.com/install-nginx-stable-1-4-1-on-debian-squeeze/

    #Start with downloading and installing PGP keys
    wget -O key http://nginx.org/keys/nginx_signing.key && sudo apt-key add key && sudo rm -f key
    
    #Add these lines to /etc/apt/sources.list
    deb http://nginx.org/packages/debian/ squeeze nginx
    deb-src http://nginx.org/packages/debian/ squeeze nginx
    
    #Update apt lists
    sudo apt-get update
    
    #Upgrade or install nginx
    sudo apt-get upgrade
    #or
    sudo apt-get install nginx
    
    Instalando PHP-FPM
    http://www.ubuntubrsc.com/instalando-nginx-php-fpm-apc-varnish-mysql-ubuntu-server-12-04.html
    
    sudo aptitude install php5-fpm php5-gd php-apc php5-imagick php5-curl php-pear php5-cli php5-common php5-mysql
    
    Instalando o MariaDB (versão 5.5)
    https://downloads.mariadb.org/mariadb/repositories/#mirror=jmu
    
    sudo aptitude install python-software-properties
    sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db sudo add-apt-repository 'deb http://mirror.jmu.edu/pub/mariadb/repo/5.5/debian wheezy main'
    sudo aptitude update
    sudo aptitude install mariadb-server
    

    Instalando o Varnish

    https://www.varnish-cache.org/installation/debian
    
    1. curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -
    2. echo "deb http://repo.varnish-cache.org/debian/ wheezy varnish-3.0" >> /etc/apt/sources.list
    3. aptitude update
    4. aptitude install varnish

    Configurando e fazendo os serviços se comunicarem

    
    Configuração do /etc/varnish/default.vcl
    http://www.lullabot.com/blog/article/configuring-varnish-high-availability-multiple-web-servers
    
    
    Acertando as configurações/permissões das pastas:
    chown -R polignu:www-data <drupal_root_folder>
    find <drupal_root_folder> -type d -exec chmod g+s {} \;
    MySQL/MariaDB small config
    https://raw.github.com/ottok/pkg-mariadb/master/support-files/my-medium.cnf.sh
    
    Outras refs:
    http://andrewdunkle.com/how-install-varnish-drupal-7
    http://www.danielmiessler.com/blog/handling-redirects-with-varnish-and-nginx
    

    Novo SO, nova vida

    De volta ao blog, foi tentar relatar e documentar aqui algumas mudanças do ponto de vista de Sistema Operacional e Ambiente em meu notebook.

    Até alguns meses atrás eu era um usuário do GnomeUbuntu, uma versão do Ubuntu com a interface Gnome3 – que eu particularmente gostei bastante.

    Mas ai decidi por tentar novas experiências e parti para o Linux Mint, com o Cinnamon como interface. O Cinnamon é um derivado do “gnome antigo” (Gnome 2), mas com muitas melhorias. Achei seu desempenho espetacular – apesar de alguns bugs eventuais que podem ser resultado da mistura com meu diretório “home” do gnome-shell.

    Bem, agora quero partir para algo um pouco mais elaborado. Vou tentar voltar a usar o Debian (testing talvez?), mas sem as interfaces tradicionais. Vou tentar migrar para o i3wm, um gerenciador de janelas baseado em “tiling”.

    Junto a ele também vou tentar utilizar o homesick , um gerenciador de arquivos de configuração que promete ajudar muito a manter suas configurações de um sistema operacional para outro.

    E, por fim, vou tentar trocar minhas configurações personalizadas do VIM por uma “distribuição” do vim bem completa, o SPF13. Não sei exatamente quando conseguirei montar esse ambiente todo, mas assim que o fizer volto aqui para documentar e contar como foi/está sendo a experiência.

    Agradecimentos do Capi Etheriel pelas indicações! =)

    Outras Refs:

    Debian issues:

    http://blog.josefsson.org/2010/10/25/debian-on-lenovo-x201/

    http://www.pbandjelly.org/2010/07/debian-squeeze-on-a-thinkpad-x201/

    http://www.linlap.com/lenovo_thinkpad_x201

    http://forums.lenovo.com/t5/Linux-Discussion-Knowledge-Base/Realtek-Wifi-Drivers-for-X201-running-Linux/ta-p/313670

    http://nodebox.metaforix.net/articles/debian-wheezy-on-lenovo-thinkpad-t420

    https://bbs.archlinux.org/viewtopic.php?id=142992

    Problema de Áudio:

    Instalar o alsa, o pulseaudio e depois rodar alsactl init