Related
For a old codebase, we're trying to go from just uploading changes through FTP to using Gitlab CI/CD. However, none of us have extensive Gitlab experience, and I've been trying to set the deployment up by following this guide:
https://savjee.be/2019/04/gitlab-ci-deploy-to-ftp-with-lftp/
I'm running a gitlab-runner on my own mac right now, however, it seems like the docker image in my yml file is not loaded correctly. When using the yml from the article:
image: ubuntu:18.04
before_script:
- apt-get update -qy
- apt-get install -y lftp
build:
script:
# Sync to FTP
- lftp -e "open ftp.mywebhost.com; user $FTP_USERNAME $FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete local-folder/ destination-folder/; bye"
It tells me apt-get: command not found. I've tried with apk-get as well, but no differences. I've tried to find a different docker image that has lftp installed ahead of time, but then I just get a lftp: command not found:
image: minidocks/lftp:4
before_script:
# - apt-get update -qy
#- apt-get install -y lftp
build:
script:
- lftp -e "open ftp.mywebhost.com; user $FTP_USERNAME $FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete local-folder/ destination-folder/; bye"
- echo 'test this'
If I comment out the lftp/apt-get bits, I do get to the echo command, however (and it does work).
I can't seem to find any reason for this when searching online. Apologies if this is a duplicate question or I've just been looking in the wrong places.
From your question, it seems you are executing your tasks on a gitlab-runner using the shell executor.
The shell executor does not handle the image keyword as exposed in the runner compatibility matrix.
Moreover, since you want to deploy on docker containers, you need the docker executor anyway.
I just tried to use Homebrew and Linuxbrew to install packages on my Ubuntu Server but both failed. This is how I tried to install them:
sudo apt-get install build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
I got the following warning:
Warning: /home/tong/.linuxbrew/bin is not in your PATH.
I vi my bash.bashrc in home/etc and add this:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
Then I tried brew doctor but got No command 'brew' found. How am I able to use Homebrew on Ubuntu?
As of February 2018, installing brew on Ubuntu (mine is 17.10) machine is as simple as:
sudo apt install linuxbrew-wrapper
Then, on first brew execution (just type brew --help) you will be asked for two installation options:
me#computer:~/$ brew --help
==> Select the Linuxbrew installation directory
- Enter your password to install to /home/linuxbrew/.linuxbrew (recommended)
- Press Control-D to install to /home/me/.linuxbrew
- Press Control-C to cancel installation
[sudo] password for me:
For recommended option type your password (if your current user is in sudo group), or, if you prefer installing all the dependencies in your own home folder, hit Ctrl+D. Enjoy.
I just tried installing it using the ruby command but somehow the dependencies are not resolved hence brew does not completely install. But, try installing by cloning:
git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew
and then add the following to your .bash_profile:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
It should work..
as of august 2020 (works for kali linux as well)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
export brew=/home/linuxbrew/.linuxbrew/bin
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile // for ubuntu and debian
The following steps worked for me:
Clone it from github
git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew
Open your .bash_profile file using vi ~/.bash_profile
Add these lines
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
Then type the following lines in your terminal
export PATH=$HOME/.linuxbrew/bin:$PATH
hash -r
Yes, it is done. Type brew in your terminal to check its existence.
You can just follow instructions from the Homebrew on Linux docs, but I think it is better to understand what the instructions are trying to achieve.
Understanding the installation steps can save some time
Step 1: Choose location
First of all, it is important to understand that linuxbrew will be installed on the /home directory and not inside /home/your-user (the ~ directory).
(See the reason for that at the end of answer).
Keep this in mind when you run the other steps below.
Step 2: Add linuxbrew binaries to /home :
The installation script will do it for us:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 3: Check that /linuxbrew was added to the relevant location
This can be done by simply navigating to /home.
Notice that the docs are showing it as a one-liner by adding test -d <linuxbrew location> before each command.
(Read more about the test command in here).
Step 4: Export relevant environment variables to terminal
We need to add linuxbrew to PATH and add some more environment variables to the current terminal.
We can just add the following exports to terminal (wait don't do it..):
export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin${PATH+:$PATH}";
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew";
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar";
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew";
export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}";
Or simply run (If your linuxbrew folder is on other location then /home - change the path):
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
(*) Because brew command is not yet identified by the current terminal (this is what we're solving right now) we'll have to specify the full path to the brew binary: /home/linuxbrew/.linuxbrew/bin/brew shellenv
Test this step by:
1 ) Run brew from current terminal to see if it identifies the command.
2 ) Run printenv and check if all environment variables were exported and that you see /home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin on PATH.
Step 5: Ensure step 4 is running on each terminal
We need to add step 4 to ~/.profile (in case of Debian/Ubuntu):
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >> ~/.profile
For CentOS/Fedora/Red Hat - replace ~/.profile with ~/.bash_profile.
Step 6: Ensure that ~/.profile or ~/.bash_profile are being executed when new terminal is opened
If you executed step 5 and failed to run brew from new terminal - add a test command like echo "Hi!" to ~/.profile or ~/.bash_profile.
If you don't see Hi! when you open a new terminal - go to the terminal preferences and ensure that the attribute of 'run command as login shell' is set.
Read more in here.
Why the installation script installs Homebrew to /home/linuxbrew/.linuxbrew - from here:
The installation script installs Homebrew to
/home/linuxbrew/.linuxbrew using sudo if possible and in your home
directory at ~/.linuxbrew otherwise. Homebrew does not use sudo
after installation. Using /home/linuxbrew/.linuxbrew allows the
use of more binary packages (bottles) than installing in your personal
home directory.
The prefix /home/linuxbrew/.linuxbrew was chosen so that users
without admin access can ask an admin to create a linuxbrew role
account and still benefit from precompiled binaries.
If you do not yourself have admin privileges, consider asking your
admin staff to create a linuxbrew role account for you with home
directory /home/linuxbrew.
Linux is now officially supported in brew - see the Homebrew 2.0.0 blog post. As shown on https://brew.sh, just copy/paste this into a command prompt:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Because all previous answers doesn't work for me for ubuntu 14.04
here what I did, if any one get the same problem:
git clone https://github.com/Linuxbrew/brew.git ~/.linuxbrew
PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$(brew --prefix)/share/man:$MANPATH"
export INFOPATH="$(brew --prefix)/share/info:$INFOPATH"
then
sudo apt-get install gawk
sudo yum install gawk
brew install hello
you can follow this link for more information.
October 2019 - Ubuntu 18.04 on WSL with oh-my-zsh;
the instructions here worked perfectly -
(first, install pre-requisites using sudo apt-get install build-essential curl file git)
finally create a ~/.zprofile with the following contents:
emulate sh -c '. ~/.profile'
Whta to do
cd /home/linuxbrew/.linuxbrew/bin
./brew doctor
You will get what path to export
echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' >> ~/.zshrc
I have downloaded Node.js from this link, which points to this link when clicking the button:
https://nodejs.org/dist/v4.1.2/node-v4.1.2-linux-x64.tar.gz
As advice from the Ubuntu community on installing the tar.gz, the following steps are followed.
$ ./configure
$ make
$ [sudo] make install
The problem is the current file I have downloaded does not contain ./configure.
So how do I install this? Should I extract this to the usr/ folder?
My OS is Debian 8 (Jessie).
Should I include the Java package from Oracle? Is it safe to extract these files to the /usr folder?
You can download this file from the browser or from the console. The latter is shown below (note: the specific Node.js version might be different for you):
Example :
wget http://nodejs.org/dist/v8.1.1/node-v8.1.1-linux-x64.tar.gz
sudo tar -C /usr/local --strip-components 1 -xzf node-v8.1.1-linux-x64.tar.gz
#tar options:
-x, --extract, --get
extract files from an archive
-f, --file ARCHIVE
use archive file or device ARCHIVE
-z, --gzip, --gunzip --ungzip`
You may find list of node version on http://nodejs.org/dist/
You should now have both Node.js and npm installed in “/usr/local/bin”. You can check this typing:
ls -l /usr/local/bin/node ls -l /usr/local/bin/npm
*An alternative way to install Node.js via the package manager:
Installing Node.js via package manager
Download the .tar.xz file form https://nodejs.org/en/ and then press Ctrl + Alt + T.
Then go to the destination that you downloaded your file to. For me it's my downloads folder. Then hit this command and Node.js will get installed on your system:
sudo tar -xf node-v16.0.0-linux-x64.tar.xz --directory=/usr/local --strip-components=1
This was the answer I had posted over two years ago, and here is what I recommand you right now, decompress the tarball, and keep it anywhere where your system knows ( tell it via updating $PATH ), its just a binary file, its not necessary to keep it in some specific location, you can keep it in your home directory and andd your bin folder to your bashrc or whatever shell you are using, its .rc file, and it will work just fine, at the end of the day, its just a pre-compiled binary file (inside node) nothing much.
Somebody in the comment section was saying npm, needs to be installed sepretly, this was in the early days of node back in 2012, when npm used to not ship with node, if you look inside bin folder npm binary is also there, so you dont need to install npm sepretly.
In case of installing from source code, you must download source code from https://nodejs.org/dist/v4.1.2/node-v4.1.2.tar.gz.
The file ending with .tar.gz is the compressed file like zip file, and you should extract the file before you can do another operation.
You can extract this file anywhere you need. In the terminal, change the location to your .tar.gz file:
$ cd /path/to/tar.gz/file
Then extract it using tar:
$ tar xvzf node-v4.1.2.tar.gz
Then change the location to the extracted directory
$ cd node-v4.1.2
After this, you can run .configure and 'make' it:
$ ./configure
$ make
$ [sudo] make install
Using the make utility is only necessary if you're compiling software. However, the tarballs provided by nodejs.org contain compiled binaries, not source code. Really you don't need to install it to use.
You can simply cd into the bin directory and run it via ./node. Though I'll say it's pretty useful to have it in your PATH. Where you put this directory doesn't really matter.
If you're installing it locally on your own machine, you can just untar it, tar xvfz node*tar.gz, to your home directory, add this to the file ~/.bashrc, and append the directory path your your PATH environment variable like so PATH=$PATH:/home/USERNAME/DIRECTORY/bin. Just change the path to the exact path to the bin folder in the directory you extracted.
You can also add these files to a directory that's already in your path, such as /usr/share or /usr/local by simple copying the files from the archive into these folders, as they share the same structure.
Run the following commands where your ta.xz file (no need for extraction) file is located in the terminal. NB: I used Kali Linux
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-v14.4.0-linux-x64.tar.xz -C /usr/local/lib/nodejs
export PATH=/usr/local/lib/nodejs/node-node-v14.4.0-linux-x64/bin:$PATH
You can now check npm -v, node -v, and npx -v.
STEP 1:
Download your version of Node.js from the Node.js website or use the below command with your version:
wget http://nodejs.org/dist/v8.1.1/node-v8.1.1-linux-x64.tar.gz
You will get a Node.js file tar file after the above step.
STEP 2:
Just use the below command for installation
sudo tar -C /usr/local --strip-components 1 -xvf node-v8.1.1-linux-x64.tar.gz
I am mentioning version-specific installation of NVM and Node.js.
If you don't have brew installed, run this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If you don't have wget installed, run this:
brew install wget
To install Node.js of a specific version, run these commands: Here, I'm installing NVM - v0.33.1 and Node.js of v0.12.6.
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
source ~/.bashrc
nvm install v0.12.6
command -v nvm //verify install
You can do some this:
# Using Ubuntu or Debian
curl -sL https://deb.nodesource.com/setup_[version].x | sudo -E bash -
sudo apt-get install -y nodejs
Where [version] must be replaced for your version of Node.js that you required install
For example, I required to install Node.js v.12
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
Download a suitable installation from
https://nodejs.org/en/download/
Incase of CentOS
Go to the downloaded file location
Execute the following
sudo tar -C /usr/local --strip-components 1 -xf "name of the tar.xz downloaded"
Check the installed version is correct
node --version
The given solution is correct, but it works for the source file and not the Linux distribution link used in the question above.
$ ./configure
$ make
$ [sudo] make install
The correct link is: https://nodejs.org/dist/v8.11.2/node-v8.11.2.tar.gz and we can use the above steps after downloading and extracting this file.
Download the latest version of Node.js from the official site, https://nodejs.org/en/
Steps to install:
Extract to any of the directories where you wish to install Node.js using a command or archive manager window
Open the terminal
Run '$sudo su'
Being superuser and open the profile file using 'nano ~/.profile'
At the end of the file, add:
# Node.js
export PATH=/path-to-bin.executable:$PATH
The path to bin application located within the bin folder of Node.js extracted folder is to be pasted in the above line
Save using Ctrl + O then come out by Ctrl + X
Refresh profile by the command '.~/.profile'
Come out of superuser by the 'exit' command
Again for normal users, use 'sudo'
'sudo nano ~/.profile'
Add the line at the end:
# Node.js
export PATH=/path-to-bin.executable:$PATH
Same as in step 5
Save and exit
Here the refresh command as above won't work, so restart the system to finish installation correctly
To get the version, issue 'node -v'
Earlier today, I ran into problems moving git folders (Move Git folder containing submodules), and the recommendation was to use a newer git version above 1.8.5. Easy, I thought, but haven't been so lucky.
I've searched high and low, and the most recent version I could find in a yum repository is 1.8.3 (PUIAS_6_computational: puias.math.ias.edu).
I then looked for help installing by source (http://www.howtoforge.com/how-to-install-the-latest-git-version-on-centos and http://tecadmin.net/install-git-2-0-on-centos-rhel-fedora/ which are almost identical), however, git is only available to the root user, and it is my understanding both these tutorials shouldn't be installing in /usr/local/.
# cd git-2.0.4
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc
Please provide a means to use Git version greater than 1.8.5.
Try following this set of instructions:
https://www.digitalocean.com/community/tutorials/how-to-install-git-on-centos-7
Then, do this:
yum remove git
exit
# reopen an terminal
Using Docker you have two options:
If you don't want to install dependencies on your host you could build it with docker, you could try this: https://github.com/wood1986/docker-library/tree/master/git
Or a quick but far from ideal way, you could execute it on a docker container, so every time you run git a container is created, your command is executed and the container is automatically removed and a cleaned up is made.
First: sudo yum remove git
then: sudo vim /bin/git
with this:
#!/bin/bash
docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git $#
last: sudo chmod 775 /bin/git
and add .gitconfig with your name and email to your home
Check your version: git --version
I'm going to install VMware 8 on debian 6 with 3.2.xx kernel. I've installed it thoroughly and it seemed that there wasn't any error in installing process.but when I want to run VMware workstation it got an error which says:
Failed to compile module vmmon
what is the cause of this error and how can I solve it?
log ouput:
2012-10-11T19:29:37.521+03:30| vthread-3| I120: Building module with command: /usr/bin/make -j -C /tmp/vmware-root/modules/vmmon-only$
2012-10-11T19:29:39.324+03:30| vthread-3| I120: Failed to compile module vmmon!
I user this commands to solve my problem:
# cd /usr/lib/vmware/modules;
# wget http://pavlinux.ru/vmware/8.0.0/source.tar.lzma;
# tar -xf source.tar.lzma;
# vmware-modconfig --console --install-all;
You need to run this command as root after each kernel upgrades :
vmware-modconfig --console --install-all
Solved in this way
Check your version $ vmplayer -v to insert in the script, in my case is 14.1.7
$ vim vmware-repair.sh
press i and paste
#!/bin/bash
VMWARE_VERSION=workstation-14.1.7 #This needs to be the actual name of the appropriate branch in mkubecek's GitHub repo for your purposes
TMP_FOLDER=/tmp/patch-vmware
rm -fdr $TMP_FOLDER
mkdir -p $TMP_FOLDER
cd $TMP_FOLDER
git clone https://github.com/mkubecek/vmware-host-modules.git #Use `git branch -a` to find all available branches and find the one that's appropriate for you
cd $TMP_FOLDER/vmware-host-modules
git checkout $VMWARE_VERSION
git fetch
make
sudo make install
sudo rm /usr/lib/vmware/lib/libz.so.1/libz.so.1
sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/vmware/lib/libz.so.1/libz.so.1
systemctl restart vmware && vmplayer &
Press ESC then :wq then ENTER
$ chmod +x vmware-repair.sh
$ sudo ./vmware-repair.sh
Source
This could help future users with the same problem
git clone https://github.com/mkubecek/vmware-host-modules
cd vmware-host-modules
git checkout workstation-16.2.3
sudo make ; sudo make install