i'm trying to install Docker-compose on my Raspberry Pi 3+ which installed Raspbian buster.
I followed instruction on docker.com. After I entered command : sudo curl -L https://github.com/docker/compose/releases/download/1.20.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose.
It show a table for downloading
Result
It seems nothing downloaded, just have a file docker-compose saved in /usr/local/bin/docker-compose. When I opened it, it empty. Then I enter command docker-compose -v, it displayed error /usr/local/bin/docker-compose : line 1: Not: command not found.
Anyone have solution?
UPDATE:
Added the following command to my answer to download the LATEST version without specifying any version number at all so the download can be scripted.
curl -L "https://github.com/docker/compose/releases/download/$(curl https://github.com/docker/compose/releases | grep -m1 '<a href="/docker/compose/releases/download/' | grep -o 'v[0-9:].[0-9].[0-9]')/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
It's a bit untidy, but it works. If you have a more elegant way than mine, ping it to me in the comments and I'll update my answer.
Just need to set the perms on the file:
chmod +x /usr/local/bin/docker-compose
Use the file command to validate that you pulled the correct arch for your system.
Intro:
Although docker-compose can be installed from a repo per the accepted answer, apt-cache show docker-compose reveals that as of 20211201 the repo version is only v1.25; about 2 years behind the current v2.1.1 release. In order to take advantage of more modern docker file versions, I needed to get the Github download working.
Short Answer:
The Docker documentation for Docker-Compose is WRONG. They forgot to preface the version number in the command with a "v"; consequently the download fails. Apparently this has been wrong for ages...
Longer Answer:
I ran the below command from the Docker-Compose documentation, and substituted the version "2.1.1" for "1.29.1" per Docker's guidance:
To install a different version of Compose, substitute 1.29.2 with the
version of Compose you want to use.
sudo curl -L "https://github.com/docker/compose/releases/download/2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
The resulting download was 9 KB for a 23 MB binary. Clearly the link was bogus. So I went to the root of the address used in the command "https://github.com/docker/compose/releases" and right-clicked on the version of Docker-Compose that I wanted and chose "Copy Link Address"
This revealed the link Docker was telling folks to use didn't have a "v" prefaced before the version number in the https:// address part of the command.
Solution:
Preface a "v" before the version number you want in the link as below and the command executes successfully:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
BTW, I too was downloading docker-compose for a Raspberry Pi using the aarch64 binary for Ubuntu 20.04 LTS. However, the missing "v" fix for the broken download address should work for any platform.
This is because on a raspberry pi the url part of the command results in
https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Linux-armv7l
Looking at the latest stable release at https://github.com/docker/compose/releases/tag/1.24.1 you can see there is no download for the armv7l architecture so the file is empty because there is nothing to download.
Will update answer once I figured out how to install docker-compose on Raspian.
Edit:
Via apt-get. Note: Currently (Nov. 8 2019) this installs version 1.21 which is not the latest available.
sudo apt-get install docker-compose
Via pip3. (Installs latest)
sudo apt-get install python3-pip
sudo pip3 install docker-compose
And then restart your system with
sudo shutdown -r
What I'm trying to do is to convert this installing script for webodm (https://gist.github.com/lkpanganiban/5226cc8dd59cb39cdc1946259c3fea6e) written in bash to be used in tcsh shell under a freenas jail.
I have now enter at part where I can't find a solution to and my hope is that someone can en light me what to do next.
The line that is triggering the problem is :
su - postgres -c "psql -d webodm_dev -c "\""CREATE EXTENSION postgis;"\"" "
The whole error line :
ERROR: could not load library "/usr/local/lib/postgresql/plpgsql.so": dlopen (/usr/local/lib/postgresql/plpgsql.so) failed: /usr/local/lib/postgresql/plpgsql.so: Undefined symbol "MakeExpandedObjectReadOnly"
pkg info give :
postgis24-2.4.5_1 Geographic objects support for PostgreSQL databases
postgresql95-client-9.5.15_2 PostgreSQL database (client)
postgresql95-contrib-9.5.15_2 The contrib utilities from the PostgreSQL distribution
postgresql95-server-9.5.15_2 PostgreSQL is the most advanced open-source database available anywhere
And yes the file exists:
root#webodm2:~ # ls -l /usr/local/lib/postgresql/plpgsql.so
-rwxr-xr-x 1 root wheel 195119 Feb 7 18:16 /usr/local/lib/postgresql/plpgsql.so
root#webodm2:~ #
So anyone have some idea ?
I faced this issue after the upgrade from postgres 11 to 12, here how to fix it for Linux and Mac (without brew)
$ sudo su postgres
$ /usr/lib/postgresql/12/bin/pg_upgrade \
--old-datadir=/var/lib/postgresql/11/main \
--new-datadir=/var/lib/postgresql/12/main \
--old-bindir=/usr/lib/postgresql/11/bin \
--new-bindir=/usr/lib/postgresql/12/bin \
--old-options '-c config_file=/etc/postgresql/11/main/postgresql.conf' \
--new-options '-c config_file=/etc/postgresql/12/main/postgresql.conf' \
you can add --check to do a dry test upgrade without changing anything in your postgres installation.
for Mac users with brew installation:
after the upgrade run the following command"
$ brew postgresql-upgrade-database
That error message means that you have a plpgsql.so from PostgreSQL 9.5 or earlier and try to use it with PostgreSQL 9.6 or later.
Either you are picking up the wrong library, or you copied files around.
Anyway, the problem has nothing to do with PostGIS.
It might be your database has an outdated version, try to run the checks before running brew postgresql-upgrade-database. OR try to restart your service brew services restart postgres.
psql --version # 11.4 <--- psql cli version
psql -c 'select version();' postgres # 10.2 <--- db version in storage
brew info postgres # check pg info <--- found solution
brew postgresql-upgrade-database # upgrade db version in storage and fixed the issue
I use Homestead Version 1.0.1 and Laravel version 5.4.16. I setup the Laravel dusk by reading the documentation.
But, when I run php artisan dusk by ssh to my homestead. I got an error like the following
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
E 1
/ 1 (100%)
Time: 2.52 minutes, Memory: 10.00MB
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown
for http POST to /session with params:
{"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary":"","args":["no-first-run"]}}}
Operation timed out after 30001 milliseconds with 0 bytes received
Is there anyway to fix this 😊?
Yes, it can be found on the github pages of Dusk. It is a known issue and they are working to update the next homestead box.
The basic issue is that the homestead box has no visual interface and
that dusk runs a real browser, so you have to install a chromedriver
if you want to use it.
But for now this worked for me:
https://github.com/laravel/dusk/issues/50#issuecomment-275155974
Not included in that post but necessary for me:
make sure you have following permission set cd vendor/laravel/dusk/bin; chmod 775 *
Steps from the github post:
First of all, google-chrome is requried to be installed in guest OS:
$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
$ sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
$ sudo apt-get update && sudo apt-get install -y google-chrome-stable
Next thing is xvfb:
$ sudo apt-get install -y xvfb
Try to start ./vendor/laravel/dusk/bin/chromedriver-linux --port=8888. If you have some errors about loading libraries (libnss3.so, libgconf-2.so.4), try this:
$ sudo apt-get install -y libnss3-dev libxi6 libgconf-2-4
When you see
$ ./vendor/laravel/dusk/bin/chromedriver-linux --port=8888
Starting ChromeDriver 2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e) on port 8888
Only local connections are allowed.
this means ChromeDriver can be started (so SupportsChrome trait should be able to start it too). You can stop this process for now (Ctrl+C).
Run
$ Xvfb :0 -screen 0 1280x960x24 &
in a separate terminal window.
Also you may want to add your dev domain in guest's /etc/hosts file:
127.0.0.1 domain.dev.
This issue is to add the chromedriver to homestead by default and will
be solved mid April. https://github.com/laravel/homestead/issues/516
I am looking for a way to schedule a set of commands on a unix server. The server time is in UTC. I essentially want to perform the below steps automatically every Wednesday at 4pm UK time:
Change the server date to the next time it is UK midnight (to avoid timezone change issues)
Restart the tomcat server
If tomcat is running, run a jar
Change the server date to the correct present UTC time
Restart the tomcat server
If tomcat is running, we are done
The below commands are what I currently run manually:
date -s "Thu Feb 09 00:01:00 UTC 2017" (represents the next day at 1 minute past midnight)
service tomcat restart
sudo -u tomcat java -jar Test.jar -type "Major" -status "Active"
date -s "<the current UTC time>"
service tomcat restart
I understand we can use cron to schedule the running of a script, but unsure how to do this. Any help is appreciated.
Create a file called called unix-server-date.sh and save it in /opt for example. The script will have this content:
#!/bin/bash
date -s "Thu Feb 09 00:01:00 UTC 2017" (represents the next day at 1 minute past midnight)
service tomcat restart
sudo -u tomcat java -jar Test.jar -type "Major" -status "Active"
date -s "<the current UTC time>"
service tomcat restart
Make the script executable:
chmod +x /opt/unix-server-date.sh
Then issue crontab -e to edit the crontab entries and add an entry like:
00 16 * * 3 /opt/unix-server-date.sh
Depending on your editor, after you have added the crontab entry please save the file and the crontab will be automatically installed.
That would be the basics!
If you run those commands from a specific user account you should add the cronjob to that user's crontab. Change crontab -e to crontab -e -u user
How to Correct Timezone
Last time, I figured out how to adjust a system clock in vagrant server. However, when I halt the vagrant and start it again, the system clock is always 9 hours late. I can adjust by using ntp command manually, but I'd like to know how to adjust the system clock automatically.
I have tried the below, but it still doesn't work. Are there any suggestions?
How to sync time on host wake-up within VirtualBox?
The method I use and it should not be provider specific is to add the following in my Vagrantfile
config.vm.provision :shell, :inline => "sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime", run: "always"
you would need to replace '/Europe/Paris' with the timezone you want to set
The simplest way is to set the timezone automatically is to use the vagrant-timezone plugin.
Install it once with:
vagrant plugin install vagrant-timezone
After that, add the below to your Vagrantfile:
if Vagrant.has_plugin?("vagrant-timezone")
config.timezone.value = "UTC"
end
You may replace "UTC" with any of the tz values listed here.
For example: "Asia/Kolkata".
Or you can use your host's timezone with this entry in your Vagrantfile:
if Vagrant.has_plugin?("vagrant-timezone")
config.timezone.value = :host
end
Accepted answer is not robust enough, as it does not account for people who travel between timezones, and requires end users to modify Vagrantfile instead of just doing vagrant up.
Building up on Scott P.'s answer, here's a better more flexible solution that matches VM timezone to host's tz automatically. There's a typo/mistake in his snippet's Etc/GMT time zone selection, as per POSIX GMT+7 sets clock 7 hours behind (see Wiki explanation), hence we need to swap offsets:
Vagrant.configure("2") do |config|
require 'time'
offset = ((Time.zone_offset(Time.now.zone) / 60) / 60)
timezone_suffix = offset >= 0 ? "-#{offset.to_s}" : "+#{offset.to_s}"
timezone = 'Etc/GMT' + timezone_suffix
config.vm.provision :shell, :inline => "sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/" + timezone + " /etc/localtime", run: "always"
end
I got:
[vagrant#ansiblecontrol ~]$ date -s \"$(curl -I google.com 2>&1 | grep Date: | cut -d' ' -f3-6)Z\"
date: extra operand ‘2018’
Try 'date --help' for more information.
This works for me:
sudo date -s "$(curl -I google.com 2>&1 | grep Date: | cut -d' ' -f3-6)Z"
Sun Apr 1 16:36:59 CEST 2018
So removed the "\" escape character.
A slightly improved version that auto-detects timezone:
The auto-detect portion came from here.
Vagrant.configure("2") do |config|
require 'time'
offset = ((Time.zone_offset(Time.now.zone) / 60) / 60)
timezone_suffix = offset >= 0 ? "+#{offset.to_s}" : "#{offset.to_s}"
timezone = 'Etc/GMT' + timezone_suffix
config.vm.provision :shell, :inline => "sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/" + timezone + " /etc/localtime", run: "always"
end
My Vagrant Guest OS time was out of sync by 7 days. The above methods did not work for me, since Guest additions and ntp were not installed in my Guest machine.
I finally solved the issue by using the hack from
https://askubuntu.com/a/683136/119371
cfg.vm.provision "shell", inline: "date -s \"$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z\"", run: "always", privileged: true, upload_path: "/home/vagrant/tmp/vagrant-shell"
The above method does not sync the Guest OS time with your host machine or any NTP server. It sends an HTTP request to google.com and updates the system time with the time in the HTTP response header field.
Hence, depending on your internet connection speed and latency, the updated time could be off by several milliseconds to a few seconds (usually < 100ms). But it shouldn't matter for most cases.
Following is the curl version, if you don't want to use wget for any reason
cfg.vm.provision "shell", inline: "date -s \"$(curl -I google.com 2>&1 | grep Date: | cut -d' ' -f3-6)Z\""
#Benny K and #Scott P.'s solution giving me the negative value of a timezone, like in #rubo77's case. Worth to note that my host OS is Windows. If timedatectl is present on your guests (like Debian 9+), this is what I used to change timezone settings:
config.vm.provision "shell",
inline: "timedatectl set-timezone Europe/Budapest",
run: "always"
This one returns the expected timezone, not the negative value:
# before timedatectl
vagrant#master:~$ timedatectl
Local time: Fri 2020-07-03 11:52:31 -02
Universal time: Fri 2020-07-03 13:52:31 UTC
RTC time: Fri 2020-07-03 13:52:31
Time zone: Etc/GMT+2 (-02, -0200)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
# after timedatectl
vagrant#master:~$ timedatectl
Local time: Fri 2020-07-03 15:53:24 CEST
Universal time: Fri 2020-07-03 13:53:24 UTC
RTC time: Fri 2020-07-03 13:53:24
Time zone: Europe/Budapest (CEST, +0200)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
Based on #Benny K.'s answer (https://stackoverflow.com/a/46778032/3194807), with the daylight saving time taken into account:
require "time"
offset = ((Time.zone_offset(Time.now.zone) / 60) / 60) + (Time.now.dst? ? 1 : 0)
timezone_suffix = offset >= 0 ? "-#{offset.to_s}" : "+#{offset.to_s}"
timezone = 'Etc/GMT' + timezone_suffix
tzShellProvision = <<_SHELL_
ln -fs /usr/share/zoneinfo/#{timezone} /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
_SHELL_
default.vm.provision :shell, inline: tzShellProvision, run: "always"
The way is to set the timezone automatically same like host using
the vagrant-timezone plugin.
Install the vagrant-timezone plugin with
vagrant plugin install vagrant-timezone
After that, add the below to your Vagrantfile
config.timezone.value = :host
Note that this functionality has only been tested with an OS X host and Linux guest.