Im trying to use Swift as a backend by installing it on an Ubuntu Server. I followed these instructions:
http://www.sitepoint.com/server-side-swift-with-perfect/
Unfortunately when I did the following:
git clone https://github.com/PerfectlySoft/Perfect.git
cd Perfect/PerfectLib
make
sudo make install
I get an error when running "make". The error is as follows:
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "curl_support.hpp"
^
/home/chris/Perfect/PerfectLib/linked/cURL_Linux/curl_support.hpp:30:10:
error: 'curl/curl.h' file not found
#include "curl/curl.h"
^
cURL.swift:26:8: error: could not build Objective-C module 'cURL'
import cURL
i tried with all the different Swift Snapshots here:
https://swift.org/download/#apple-platforms
but still nothing.
Please can anyone help? Im using Ubuntu 14.04
You need to install curl library in order to have it on your system :)
sudo apt-get install curl should solve your problem.
I personally use this vagrantfile, that sets up my Virtual Machine (so I don't mess up my regular linux settings by mistake)
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## 1 get the ubuntu image
config.vm.box = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.provision "shell", inline: <<-SHELL
## 2 Install all necessary dependencies
sudo apt-get --assume-yes install clang libssl-dev libevent-dev libsqlite3-dev libicu-dev uuid-dev libcurl4-openssl-dev git
## 3 get the swift snapshot
curl -O https://swift.org/builds/ubuntu1404/swift-2.2-SNAPSHOT-2015-12-01-b/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
## 4 unpack
tar zxf swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
## 5 add swift snapshot to PATH
echo "export PATH=/home/vagrant/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin:\"${PATH}\"" >> .profile
echo "Swift has successfully installed on Linux"
## 5.5 create tiny script that will install all the Perfect Libs and have them accessible for the non-sudo user
echo "git clone https://github.com/PerfectlySoft/Perfect.git
cd Perfect/PerfectLib
make
sudo make install
cd ../PerfectServer
make" >> compilePerfectLib.sh
chmod a+x compilePerfectLib.sh
echo "Remember to run ./compilePerfectLib.sh after logging into the VM"
SHELL
config.vm.network :public_network #, bridge: "wlan0"
config.vm.network :forwarded_port, guest: 8181, host: 8181
config.vm.boot_timeout = 300
end
Then after you do vagrant ssh and you're logged in the VM (Virtual Machine), you need to sh ./compilePerfectLib.sh and that will setup your environment :)
Good luck!
Related
I am trying to install erlang 25 (and elixir 1.13) on my ubuntu VM, but the default version installed by apt is erlang 24.
I've tried both :
sudo wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.d
sudo apt update
and
sudo wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.d
sudo apt update
but in both case, running apt-cache policy esl-erlang didn't show the desired version. I have recently installed erlang 25 on a identical vm, and I don't remember struggling at all, so I'm guessing there's a simple way of doing it that I just forgot ?
I hope you can help me, thank you !
From the Erlang OTP repo, you should do:
apt-get install erlang
If you decide to compile from source:
git clone https://github.com/erlang/otp.git
cd otp
git checkout maint-25 # current latest stable version
./configure
make
make install
Alternatively, you can use Kerl:
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
and place kerl in your PATH so that you can invoke it from the terminal (remember to source your .bashrc or similar if you update your PATH variable there, or open a new terminal to reload the PATH env), i.e.,
export PATH=<path-to-kerl>:$PATH
Instructions on how to use it here.
I would recommend the usage of the Erlang Version Manager, thanks to which you can compile and install any Erlang OTP version you need, regardless of what the default version is currently available for your Linux distro.
Installation of Erlang Version Manager:
$ git clone https://github.com/robisonsantos/evm /tmp/evm/
$ cd /tmp/evm/
$ /tmp/evm/install
$ echo 'source ~/.evm/scripts/evm' >> ~/.bashrc
$ bash
Installation of the specific Erlang OTP version:
$ evm install 25.1.1 -y
$ evm default 25.1.1
From this instruction it looks like Google allows booting to the sdcard. However, the image they provided (recovery.img) is only an image to boot the board automatically to U-boot, after which you'll still have to flash the MendelOS to eMMC with USB.
I'd like to have the entire OS on the sdcard, that way it's easier to make copy of it and save the state of the OS.
In order to create a MendelOS image that can be flashed in to an sd-card, you'll need to build the image your self. The steps for doing this:
Cloning the Mendel repo's source from here
# Get the repo binary that's necessary to clone Mendel
$ mkdir -p bin
$ export PATH=$PATH:$HOME/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
# Setup your git env
$ git config --global user.name "Your Name"
$ git config --global user.email "you#example.com"
# clone the repo
$ mkdir mendel && cd mendel
$ repo init -u https://coral.googlesource.com/manifest -b release-day
$ repo sync -j$(nproc)
Make sure that the build system on your host machine meets these requirements:
# System
A 64-bit CPU
Kernel 4.15 or newer
binfmt-support 2.1.7 or newer
# OS
The suggested OSes are: Ubuntu 18.10+ or Debian Buster or newer.
# Install qemu
$ sudo apt-get install qemu-user-static
# Install docker
$ sudo apt-get install docker.io
$ sudo adduser $USER docker
Build:
$ sudo su
$ source build/setup.sh
$ FETCH_PACKAGES=true m docker-sdcard
After the build succeeds, you'll see your sdcard image in the out directory. You can install that to your sdcard using the dd command or some opensrouce tools like Balena Etcher.
Enable boot from the sd-card by switching the boot switch to as described ON OFF ON ON here.
Cheers!
I'm trying to setup Vagrant with docker as a provider but when running
vagrant up --provider=docker --debug
I get this error:
"rsync" was not detected as installed in your guest machine. This
is required for rsync synced folders to work. In addition to this,
Vagrant doesn't know how to automatically install rsync for your
machine, so you must do this manually.
Full log here:
http://pastebin.com/zCTSqibM
Vagrantfile
require 'yaml'
Vagrant.configure("2") do |config|
user_config = YAML.load_file 'user_config.yml'
config.vm.provider "docker" do |d|
d.build_dir = "."
d.has_ssh = true
d.ports = user_config['port_mapping']
d.create_args = ["--dns=127.0.0.1","--dns=8.8.8.8", "--dns=8.8.4.4"]
d.build_args = ['--no-cache=true'] end
config.vm.hostname = "dev"
config.ssh.username = "it" config.ssh.port = 22 config.ssh.private_key_path = ["./initial_ssh_key", user_config['ssh_private_key_path']] config.ssh.forward_agent = true
end
Dockerfile
FROM debian:jessie MAINTAINER IT <it#email.com>
RUN echo 'exit 0' > /usr/sbin/policy-rc.d
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update RUN apt-get upgrade -y RUN apt-get install sudo apt-utils -y
RUN apt-get -y install sysvinit-core sysvinit sysvinit-utils RUN cp /usr/share/sysvinit/inittab /etc/inittab RUN apt-get remove -y --purge
--auto-remove systemd libpam-systemd systemd-sysv
RUN apt-get install ssh -y
RUN addgroup --system it RUN adduser --system --disabled-password
--uid 1000 --shell /bin/bash --home /home/it it RUN adduser it it RUN adduser it sudo
RUN echo "it ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
ADD initial_ssh_key.pub /home/it/.ssh/authorized_keys RUN chown it:it /home/it/ -R RUN echo "Host * \n\tStrictHostKeyChecking no" >> /etc/ssh/ssh_config
CMD exec /sbin/init
Note:
I'm on Mac OS X 10.12 and I've installed vagrant, virtualbox and docker I have rsync installed and added to my PATH in the host machine.
Also, the same vagrant and docker configs works perfectly on a ubuntu host.
How do I install rsync in the guest machine? Or is something else wrong with my config? Any ideas?
You may want to give the alternative boot2docker box a try: https://github.com/dduportal/boot2docker-vagrant-box
as it contains rsync while the hashicorp/boot2docker, which is used by default, seems to lack this!
If doing so, you must add the follwong line to your docker provider config (of course adopted to your system):
d.vagrant_vagrantfile = "../path/to/Vagrantfile"
This is because you're changing the docker provider host vm as described in the vagrant docker provider documentation.
Try adding rsync to your Docker file, somewhere in one of your apt-get lines. Linux hosts use NFS by default, that's why it works on your Ubuntu.
Normally Vagrant tries to install rsync on a guest machine, if that fails - it notifies you with that error message. More info on vagrant website (3rd paragraph in "Prerequisites" chapter)
I recently had to destroy and recreate my Vagrant instance. Now I can't run any rails command as it says Rails is not installed. When I did
Vagrant Up
I got the following error
default: /tmp/vagrant-shell: line 1: /home/vagrant/.rvm/scripts/rvm: No such file or directory
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
My Provision.sh file contains the following:
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main " | sudo tee -a /etc/apt/sources.list.d/pgdg.list
sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get remove postgresql-client-9.1 postgresql-client-common postgresql-client postgresql-common -y
sudo apt-get install postgresql-9.3 postgresql-client-9.3 libpq-dev curl git build-essential libxslt-dev libxml2-dev -y
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
curl -sSL https://get.rvm.io | bash -s stable --ruby
cat << EOF | sudo tee -a /home/vagrant/.bashrc
cd /vagrant
EOF
echo '# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust' | sudo tee /etc/postgresql/9.3/main/pg_hba.conf
echo 'machine api.heroku.com
login *****
password ****
machine code.heroku.com
login *****
password *****
' | tee /home/vagrant/.netrc
echo 'ssh-rsa ***** vagrant#precise32
' | tee /home/vagrant/.ssh/id_*****.pub
chmod 0600 /home/vagrant/.netrc
sudo -u postgres psql -c "create user ***** createdb createuser password '*****';"
sudo /etc/init.d/postgresql restart
I have seen some answers (not specific to Vagrant) suggesting that I must have installed rvm using sudo or as root and need to remove it and then get rvm again. I have tried to do that butI'm not sure how it applies to a vagrant box and at any rate I must have done it wrong as it hasn't worked.
Is there something I need to correct/add to my provision.sh file or to my Vagrantfile?
Vagrant runs the provisioning file as root, so you would have indeed installed rvm as root unless you specified otherwise*. This was quite confusing for me as well (also a newbie), I would install things during provisioning and they would "disappear". In fact, they were all being installed / set as root.
*Or, you manually installed rvm when ssh'd into the machine, which I'll touch on more below.
You can switch your user using su -c "source /home/vagrant/myapp/vagrant/user-config.sh" vagrant
What goes in the "" is any command you want to execute. In this case, we're switching to a separate shell file user-config.sh that contains all the commands that should not be run as root, such as installing RVM.
I also sense somewhat of a conceptual misunderstanding. Each time you do vagrant destroy your entire virtual machine is destroyed, hard drives and all. The next time you do vagrant up, everything is rebuilt from scratch. If you had ssh'd in and installed things, they'll no longer be there.
This means that all of your install and config goes into the provisioning file, and you shouldn't be installing things manually after the fact. You should be able to vagrant destroy any time you want.
Take a read through https://coderwall.com/p/uzkokw/configure-the-vagrant-login-user-during-provisioning-using-the-shell-provider once more, I'm hoping it makes more sense this time around.
May be this link helps you to install rvm using Vagrant.
RVM_Vagrant
I am trying to deploy to AWS the sample Rubber test in the Quick Start wiki
https://github.com/rubber/rubber/wiki/Quick-Start
I get past the part where it prompts for my local machine password to write to the hosts file ( it creates roles, the instance, and a lot of other things; I even got through another error where it was not connecting - I renamed the private key without the .pem extension and that fixed that ), and it runs on for a while, and gives an error here:
failed: "/bin/bash -l -c 'sudo -p '\''sudo password: '\'' bash -l -c '\''export DEBIAN_FRONTEND=noninteractive; apt-get -q -o Dpkg::Options::=--force-confold -y --force-yes install postfix build-essential git-core libxslt-dev ntp mysql-client libmysqlclient15-dev subversion curl autoconf bison ruby zlib1g-dev libssl-dev libreadline6-dev libxml2-dev libyaml-dev apache2 libapache2-mod-proxy-html libcurl4-openssl-dev libapache2-mod-xsendfile apache2-mpm-prefork apache2-prefork-dev collectd libperl-dev monit mysql-server percona-toolkit openjdk-7-jdk unzip python-django python-django-tagging python-cairo python-memcache memcached uwsgi uwsgi-plugin-python uwsgi-plugin-http sqlite3 bzr zip mongodb-10gen haproxy ec2-ami-tools'\'''" on production.foo.com
I got the same failure, and looking just above that line at the output from the command, I saw that the uwsgi-plugin-http package needs to be replaced by the uwsgi-core package.
There apparently a pull request to fix this that has not yet been accepted, but you can fix it by making the same edit: on rubber 2.8.1, open config/rubber/rubber-graphite.yml, go to line 22, and it should look like this:
packages: [python-django, python-django-tagging, python-cairo, python-memcache, memcached, uwsgi, uwsgi-plugin-python, uwsgi-plugin-http, sqlite3, bzr, zip]
Replace uwsgi-plugin-http with uwsgi-core so the line will be:
packages: [python-django, python-django-tagging, python-cairo, python-memcache, memcached, uwsgi, uwsgi-plugin-python, uwsgi-core, sqlite3, bzr, zip]
Then, run cap rubber:bootstrap, and it should finish setting up your instance.