Arquivo da categoria: Ubuntu

Rails – Script de deploy in server ubuntu

echo “Configurando a linguagem”
sudo apt-get install language-pack-pt

echo “Configurando o relogio”
sudo apt-get update
sudo apt-get install tzdata
sudo dpkg-reconfigure tzdata

echo “Criando usuario deploy”
sudo adduser deploy

echo “Criando configuracoes SSH”
su deploy
ssh-copy-id deploy@SERVER_IP_ADDRESS
cat ~/.ssh/
su – deploy
mkdir .ssh
chmod 700 .ssh
touch .ssh/authorized_keys
chmod 600 .ssh/authorized_keys

echo “Liberando o SSH – PermitRootLogin yes | PasswordAuthentication yes”
sudo nano /etc/ssh/sshd_config
sudo service ssh restart
sudo usermod -a -G sudo deploy

echo “Logando como deploy”

echo “Instalacoes”
sudo apt-get update
sudo apt-get install curl git-core nginx libpq-dev imagemagick -y

echo “Instalando o Ruby e Rails”
gpg –keyserver hkp:// –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install VERSAO
gem install rails -v VERSAO
gem install bundler -V

echo “Instalando o NodeJS”

curl -sL | sudo -E bash – sudo apt-get install -y nodejs

echo “SHH do Bitbucket”
ssh -T
ssh-keygen -t rsa
echo “Olhar aqui:”

echo “git clone”
git clone

echo “Estruturar o disparo do capistrano”
cat ~/.ssh/ | ssh -p your_port_num deploy@your_server_ip ‘cat >> ~/.ssh/authorized_keys’

echo “Atualizando”
cap production deploy:initial

echo “Ajustes no Nginx”
sudo rm /etc/nginx/sites-enabled/default
sudo ln -nfs “/home/deploy/apps/appname/current/config/nginx.conf” “/etc/nginx/sites-enabled/appname”
sudo service nginx restart

How to SSH into a Ubuntu server after getting a “permission denied (publickey)” error

Updating your SSH configuration to allow password authentication

  1. Once you’ve launched the console, it will ask you for your user name and password. If you had to reset your root password and are using your root user to log in, it will prompt you to create a new password by typing it twice.
  2. Once you are logged in, you will need to update your sshd_config file by typing:
vim /etc/ssh/sshd_config

or if you are accessing it with a non-root user with sudo privileges, type:

sudo vim /etc/ssh/sshd_config

3. From there, you want to type i for INSERT (to edit your file) and find the option that says PasswordAuthentication no and update it to

PasswordAuthentication yes 

Then, type:


followed by:


to write and quit out of the file, followed by hitting enter.