Trouble setting up Vagrant - django

I've been trying to setup Vagrant to learn Django for a while now. I am following [http://gettingstartedwithdjango.com/en/lessons/introduction-and-launch/][1] tutorial. The first error is default: stdin is not a tty
and the second is
==> default: ERROR: Error installing chef:
==> default: mixlib-shellout requires Ruby version >= 1.9.3.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
I am using Ubuntu 14.04 LTS x86_64 as host machine.
sudo apt-get install ruby gives me "Already in the newest version". Tried installing chef manually. No luck either :(

I had a very similar issue (Vagrant, Django) which I solved by downgrading Chef. I had to pin a couple of gems too due to some version mismatches. This didn't solve all my issues but it did solve the OP's error with mixlib-shellout.
In my Vagrant file
# Install an older version of chef
config.vm.provision :shell, :inline => 'apt-get install build-essential ruby1.9.1-dev --no-upgrade --yes'
config.vm.provision :shell, :inline => "gem install mixlib-shellout --version 1.4.0 --no-rdoc --no-ri --conservative"
config.vm.provision :shell, :inline => "gem install ohai --version 7.4 --no-rdoc --no-ri --conservative"
config.vm.provision :shell, :inline => "gem install chef --version 11.18.12 --no-rdoc --no-ri --conservative"
More here.
https://www.chef.io/blog/2014/12/02/postmortem-ohai-mixlib-shellout-gem-release-issues/

Related

Installing Chromium on Amazon Linux

I am trying to install Chromium (or Chrome, whichever) on an Amazon Linux machine.
I have tried many steps, to no avail. Here is what I have tried:
Simple Yum Install
yum install epel # worked
yum install chromium
generated error message:
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
Requires: libgnome-keyring.so.0()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
Requires: libgtk-x11-2.0.so.0()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
Requires: libgdk_pixbuf-2.0.so.0()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
Requires: libXss.so.1()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
Requires: libgdk-x11-2.0.so.0()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
Requires: libcanberra-gtk2(x86-64)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
Requires: libatk-1.0.so.0()(64bit)
Yum install of specific RPM package
I tried downloading a Chrome RPM, both the latest stable version as well as a specific version, and then running
yum install google-chrome-stable-64.0.3282.119-1.x86_64.rpm
It yielded the same error message
Manual procedure
Downloaded binary from https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/532015/
Running it generated the error message
error while loading shared libraries: libXcursor.so.1: cannot open shared object file: No such file or directory
I ran
yum install libXcursor
yum install libXfixes # because chrome was then complaining about that library
yum install libXdamage # and subsequently that one
which all worked.
However, then Chrome started complaining about a libcups library :
error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory
libcups wasn't found by yum, and it seems that this is because it is a 32 bit library. Some page recommended to install ia32-libs as a solution, but running yum install ia32-libs showed that it was already installed.
I couldn't get past that point.
Other
I also tried steps mentioned here, but that didn't work
some pages point to using dpkg, but that command doesn't exist on Amazon Linux apparently
apt neither
None of these answers , work, and none of them actually solves problem for amazon linux,
To really solve the problem if you are using EC2 instance or any other server where you are running Amazon linux, you should follow the below steps .
Enable and install Extra Packages for Enterprise Linux by running the command
sudo amazon-linux-extras install epel -y
Post installing all the extra packages successfully, Install chromimum as usual
sudo yum install -y chromium
Once you do that Chromium will have all required such as libatk* libgdk* etc ...
You should be able to easily launch Chromium
The missed out packages that you are looking here, are actually not missedout they are kind of default you just have to enable them , this is well documented in AWS documentation .
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/
In order to get headless chrome working on Lambda, I deployed an identical AMI as an EC2 instance (currently amzn-ami-hvm-2017.03.1.20170812-x86_64-gp2). After installing chrome, the usual litany of missing dependencies begins.
Reference: https://medium.com/mockingbot/run-puppeteer-chrome-headless-on-ec2-amazon-linux-ami-6c9c6a17bee6
Navigate to the folder containing the chrome executable and use ldd to check for missing dependencies:
$ ldd chrome | grep not
libpangocairo-1.0.so.0 => not found
libpango-1.0.so.0 => not found
libcairo.so.2 => not found
libXcursor.so.1 => not found
libXdamage.so.1 => not found
libXfixes.so.3 => not found
libcups.so.2 => not found
libXss.so.1 => not found
libXrandr.so.2 => not found
libgconf-2.so.4 => not found
libatk-1.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found
libgdk_pixbuf-2.0.so.0 => not found
Install the following:
$ sudo yum install cups-libs dbus-glib libXrandr libXcursor libXinerama cairo cairo-gobject pango
Check again:
$ ldd chrome | grep not
libXss.so.1 => not found
libgconf-2.so.4 => not found
libatk-1.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found
libgdk_pixbuf-2.0.so.0 => not found
We need to grab these dependencies from a maddeningly large set of RPMs:
# Install ATK from CentOS 7
$ sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/atk-2.22.0-3.el7.x86_64.rpm
$ sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-atk-2.22.0-2.el7.x86_64.rpm
$ sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-core-2.22.0-1.el7.x86_64.rpm
# Install GTK from fedora 20
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/g/GConf2-3.2.6-7.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/l/libXScrnSaver-1.2.2-6.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/l/libxkbcommon-0.3.1-1.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/l/libwayland-client-1.2.0-3.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/l/libwayland-cursor-1.2.0-3.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/g/gtk3-3.10.4-1.fc20.x86_64.rpm
# Install Gdk-Pixbuf from fedora 16
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/16/Fedora/x86_64/os/Packages/gdk-pixbuf2-2.24.0-1.fc16.x86_64.rpm
That should resolve all the dependencies and chrome should be able to run, finally!!
I use chromium for headless testing via AWS Ubuntu launched through CodeBuild. I found I had to update node and install a set of chromium dependencies.
#!/bin/sh
echo "Installing nodejs (which will include node and npm)"
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs
echo "Installing chromium dependencies"
apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
For those using Amazon Linux 2022, there are several packages missing, running ldd chrome | grep not in the Chromium directory yields:
libnss3.so => not found
libnssutil3.so => not found
libsmime3.so => not found
libnspr4.so => not found
libgbm.so.1 => not found
These packages aren't available for Amazon Linux 2022 but you can find them on https://rhel.pkgs.org/8 which works because this distribution is based on RHEL 8.
So these should fix it:
sudo dnf install http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-1.noarch.rpm
sudo dnf install nss
sudo dnf install mesa-libgbm

Rails/Centos7 - ERROR: Error installing rails: ERROR: Failed to build gem native extension

I got this error message when trying to install rails on Centos 7.
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
Gem files will remain installed in /usr/local/share/gems/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /usr/local/share/gems/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out
Command
gem install rails -v 4.2.3 --no-rdoc --no-ri
Nokogiri is causing you problems. Installing all the build dependencies and try again.
sudo yum install -y gcc ruby-devel zlib-devel libxml2 libxml2-devel libxslt libxslt-devel make
If it still fails, try to build it with the --use-system-libraries build option.
gem install nokogiri -- --use-system-libraries
If all else fails, install it from the EPEL repository.
sudo yum install -y epel-release
sudo yum install -y rubygem-nokogiri

rails 4.2.0: can't install pg gem on ubuntu 14.04

I have recently tried to upgrade my rail 3.2* application to rails 4.2.*. But, I was stopped while installing the 'pg' gem. When I googled it, the solutions which are mostly related to OSX only. But I'm using ubuntu 14.04. Need any suggestion for the below issue.
I have installed postgresql 9.3.5 version on my machine.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.2#r4/gems/pg-0.18.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.2#r4/extensions/x86_64-linux/2.1.0/pg-0.18.1/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
You need install the postgreSQL dev package with header of PostgreSQL
sudo apt-get install libpq-dev
You may also try
sudo apt-get install postgresql-client
sudo apt-get install postgresql postgresql-contrib
Ran into this exact problem trying to gem install pg -v 0.18.1 with postgresql 9.4 on ubuntu 14.04
sudo apt-get install libpq-dev build-essential postgresql-server-dev-9.4
Basically I was missing postgresql-server-dev-${version}
In your case try
sudo apt-get install libpq-dev build-essential postgresql-server-dev-9.3
Follow this command on ubuntu 16.04
sudo apt install libpq-dev postgresql-server
sudo -u postgres createuser -s $(whoami); createdb $(whoami)
gem install pg

Error installing libjpeg on Ubuntu 13.04

While installing libjpeg on PIL, Python 2.7
sudo apt-get install libjpeg-dev
i'm getting an error:
WARNING: The following packages cannot be authenticated!
libjpeg-turbo8-dev libjpeg8-dev libjpeg-dev
Install these packages without verification [y/N]? y
Err http://archive.ubuntu.com/ubuntu/ raring-updates/main libjpeg-turbo8-dev i386 1.2.1-0ubuntu2.13.04.1
404 Not Found
Err http://security.ubuntu.com/ubuntu/ raring-security/main libjpeg-turbo8-dev i386 1.2.1-0ubuntu2.13.04.1
404 Not Found
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8-dev_1.2.1-0ubuntu2.13.04.1_i386.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Update 1:
sudo apt-get update
Err http://archive.ubuntu.com raring-updates/main i386 Packages
404 Not Found [IP: 91.189.88.149 80]
it seems that the ip/address of Ubuntu libs repositories changed,
because the system already after "End Of Life", so you need to manually edit repositories list that used by apt-get.
you can see a hint for it here and here.
in my case, i preferred to upgrade to 14.04. it's a LTS version, so next time I should meet this problem will be after 5 years of usage.
to upgrade yours look this site.
for now (September 2014) I needed to upgrade it twice.
once from 13.04 to 13.10 and next to 14.04.
note: the first step was suggested to do by "sudo update-manager -d", but this doesn't work because of the same repositories problem. so I used "sudo do-release-upgrade"

Cannot Bootstrap chef (10.8) on new EC2 Instance - net-ssh conflict

I have found Can't install chef, gem version conflict with net-ssh net-ssh-multi net-ssh-gateway in my research, but unfortunately none of those workarounds work for me in my particular case.
I'm trying to bootstrap chef on an EC2 instance.
I cannot upgrade to 11.x.
This one does not work: (added command I run to install chef which includes --verbose and --version)
gem install net-ssh -v 2.2.2 --no-ri --no-rdoc
gem install net-ssh-gateway -v 1.1.0 --no-ri --no-rdoc --ignore-dependencies
gem install net-ssh-multi -v 1.1.0 --no-ri --no-rdoc --ignore-dependencies
gem install chef --no-ri --no-rdoc --verbose --version 0.10.8
Is there any way to work around this problem without upgrading chef?
I've also tried the above but with
gem install chef --pre --no-ri --no-rdoc
and that fails too. These are both workarounds outlined in the linked post above.
Does this blog post by Joshua Timberman help?
I encountered these issues running a 0.10.4 Chef Server and equivalent Chef Clients when using Knife EC2 tool to launch servers.
For anyone else like me who had issues getting KNIFE to launch an instance without this net-ssh issue, placing the following in my bootstrap file didn't work as per recommendations elsewhere on SO:
gem install chef --no-ri --nordoc --verbose --version 0.10.24
The way that worked was to use a flag on the knife ec2 command:
--bootstrap-version 10.24.0
The version can be higher than 10.20.0.