downgrade chef-client version 11 - knife

trying to downgrade chef-client. enclosed a snippet:
$ chef-client --version
Chef: 11.10.4
$ curl -sL https://www.opscode.com/chef/install.sh | sudo bash -s -- -v 11.8.2
Downloading Chef 11.8.2 for ubuntu...
downloading https://www.opscode.com/chef/metadata?v=11.8.2&prerelease=false&nightlies=false&p=ubuntu&pv=12.04&m=x86_64
to file /tmp/install.sh.1934/metadata.txt
trying wget...
url https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.8.2-1.ubuntu.12.04_amd64.deb
md5 3d3b3662830a44eeec71aadc098a4018
sha256 a5b00a24e68e29a01c7ab9de5cdaf0cc9fd1c889599ad9af70293e5b4de8615c
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.8.2-1.ubuntu.12.04_amd64.deb
to file /tmp/install.sh.1934/chef_11.8.2-1.ubuntu.12.04_amd64.deb
trying wget...
Comparing checksum with sha256sum...
Installing Chef 11.8.2
installing with dpkg...
(Reading database ... 107385 files and directories currently installed.)
Preparing to replace chef 11.8.2-1.ubuntu.12.04 (using .../chef_11.8.2-1.ubuntu.12.04_amd64.deb) ...
Unpacking replacement chef ...
Setting up chef (11.8.2-1.ubuntu.12.04) ...
Thank you for installing Chef!
$ chef-client --version
Chef: 11.10.4
also tried rebooting the machine, though there result is the same.
can it be done, can chef-client be downgraded?

If you installed Chef 11.10.4 from the omnibus installer (basically the same install.sh you are using for the older version) then you basically got a self-contained installation of Chef inside /opt/chef.
Removing that directory will remove almost all traces of the old install. All that is left is to remove the symlinks inside /usr/bin, which will probably be chef-client, chef-solo, chef-shell, knife, ohai and maybe a few others (look for symlinked files in /usr/bin that point to /opt/chef.
After that, reinstall using your above technique and you should have the correct version installed.

Just install specific version from https://downloads.chef.io/chef (depends on your OS). I succeeded to downgrade my chef-client version with simple installation that override the newer one.

Related

Is there a way to update visual-studio-code-bin which is installed from the arch wiki

visual-studio-code-bin is installed from the arch wiki. The only way I know how to actually update the software is reinstalling it again from the arch wiki which is tedious and inconvenient.
Any help is appreciated
Old post with a lot of split information so for anyone who finds this later, you have 2 choices:
Install the open source version of visual studio code from the official repos.
Install the official Microsoft binary version via the AUR that contains some proprietary code from Microsoft that is not available in the fully open version (e.g. some debugging some languages).
Info on how to do this can be found in the wiki.
It depends on how you installed vscode. If you did sudo pacman -S code, then the solution is to run it again. But if you did yay -S visual-studio-code-bin, then you should run THIS command again.
The best way to use VS Code on Arch is to use the open source version on the community repos. Which you can install by doing
sudo pacman -S code
visual-studio-code-bin is the proprietary binary which can be installed from the Arch User Repository.
If for some reason you want to go for the latter approach, you can either use an AUR helper or manage everything manually.
You can see the Arch Wiki's page on AUR helpers which shows the different options you have: https://wiki.archlinux.org/index.php/AUR_helpers
You can use these helpers to help manage your updates just like you would on pacman.
Here's how you would do things manually: https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_and_upgrading_packages
Just as a warning, AUR helpers are not supported by Arch Linux and the manual approach, though less user friendly is the recommended way by the Arch Wiki to manage your AUR Packages.
First a short version:
Simply run
sudo pacman -Sy
sudo pacman -S visual-studio-code-bin
The longer explanation:
Getting the right version of vscode
First of all, "code" and "visual-studio-code-bin" are two different packages. "code" is an open-source release and "visual-studio-code-bin" is an Microsoft-branded release. One of the major differences is that "code" doesn't support any Microsoft Extensions like C/C++, to my knowledge. This information can be found in the arch wiki: https://wiki.archlinux.org/title/Visual_Studio_Code#Installation. For more detailed information about the differences I'll refer you to the vscode repository: https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code
By running "sudo pacman -S code" you (unintentionally) uninstall "visual-studio-code-bin" and install "code" because of wired some decency conflict.
So if you want to update/install "visual-studio-code-bin" run:
sudo pacman -S visual-studio-code-bin
This should fix any Problems with no functioning Microsoft-Extensions
Of course if you want to sick to the open-source version you can use
sudo pacman -S code
Fixing your Problem with not updating to the right version
I have to admit this took me ages. I had two machines, one with an freshly installed version of geruda Linux (an arch based distro) and an six moth old version of geruda Linux. Both had vscode installed. At the time of writing this the current version of vscode is 1.59.0-1. Interestingly the my old machine, witch had vscode version 1.58.0-1 installed didn't know that there was an newer version. The newer machine was aware of the the newer version. An simply running pacman -S visual-studio-code-bin didn't change anything. This hinted my to the problem of an not synchronized package database. And forcefully synchronizing the database with
sudo pacman -Sy
did the trick for me. For a more detialed information I would redirect you to the man pages: https://archlinux.org/pacman/pacman.8.html or this thread https://bbs.archlinux.org/viewtopic.php?id=117765. After running this command you only need to install vscode with "sudo pacman -S visual-studio-code-bin" or "sudo pacman -S code" to get the newest version of vscode
As rightly said by #AlexanderHD27 code is open source and vscode is microsoft official version but it is not open source. though code is more like an experimental version of of vscode; however, you can install code directly in archlinux using sudo pacman -S code but for the the vscode you have to clone the repository from github and install in the following way:
git clone visual-studio-code-bin
then cd visual-studio-code-bin and makepkg -si
remember if you don't have git installed you can do that using sudo pacman -S git. As for the update; code is updated during system full update but vscode is not updated. So, you have to cd into the directory again and do git pull the makepkg -si again.
As KamilCuk and Aviad mentioned there is no visual-studio-bin package, since it is a aur package you can use yay (AUR helper) to get a updateable version. For more information about yay see: https://github.com/Jguer/yay.
Install yay
sudo pacman -S --needed base-devel git
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ..
rm -rf yay
Install visual-studio-code-bin with yay
# install
yay -S visual-studio-code-bin
If you installed vscode via pamac manager in manjaro, try this:
pamac update
To update with the cloned AUR directory.
First update pacman database:
pacman-Sy
Then in the AUR directory you can update the AUR to the latest version with:
git pull
Then update dependencies with:
makepkg -s
Finally you install it:
makepkg -i
==> WARNING: A package has already been built, installing existing package...
==> Installing package visual-studio-code-bin with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...
Packages (1) visual-studio-code-bin-1.73.1-1
Total Installed Size: 324.26 MiB
Net Upgrade Size: 29.66 MiB
:: Proceed with installation? [Y/n]

How to uninstall terraform and install newer version of terraform on windows 10 linux subsystem?

i want to install a newer version of terrafrom 0.12.24 on windows 10 linux subsystem. i am new to using this interface and i am not sure how to do it
i installed terraform on Windows 10 linux subsystem using these commands
wget https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip -O
terraform.zip;
unzip terraform.zip;
sudo mv terraform /usr/local/bin;
rm terraform.zip;
however this installed older version.. and when i ran some script it gave me this error.
Failed to load root config module: Error parsing terraform/local/terraform.tf: At 119:12: Unknown token: 119:12 IDENT file
To fix this i am planning to upgrade to newer version of terrafrom 0.12.24. could someone provide me with commands to uninstall and install newer version of terraform thanks.
This should install 0.12.24 version
wget https://releases.hashicorp.com/terraform/0.12.24/terraform_0.12.24_linux_amd64.zip
unzip terraform_0.12.24_linux_amd64.zip
sudo mv terraform_0.12.24_linux_amd64 /usr/local/bin
rm terraform_0.12.24_linux_amd64.zip
Let me explain what these steps are:
1) The link given along with wget is the downloadable link for the required package. wget helps in downloading it. I changed the version here as your required version.
2) unzip it
3) moved to /usr/local/bin folder.
4) Removing the zip as we have already copied the contents to bin folder
This is probably more appropriate as a comment but I do not yet have the reputation to do that. As of version 0.15.1, it unzipped only as "terraform", so line 3 in the above answer could just be:
sudo mv terraform /usr/local/bin
And this worked for me.

How to install smlnj in arch linux?

Earlier I was in Ubuntu & it was easy to install smlnj using
apt-get install smlnj
but now I shifted to Arch & I'm finding it difficult to install smlnj.
I tried to find smlnj package through yaourt but I didn't found any.
Then I tried to install it by steps given in official site by downloading tar file. I followed given steps and extracted tar file in /usr/local/sml & then compiled by running command
config/install.sh.
After doing all this I tried to run sml but was not successful. I tried setting environment variable but again was not successful.
Please tell me whether I'm missing any steps or doing it wrong way. What is correct way to install smlnj in Arch Linux?
Update: As Alexander (xyproto) points out, pacman -S smlnj should work again now that SML/NJ is in the [multilib] repository. The solution below would still work, but credit for making installation more convenient should go to him. :-)
Before: It seems that the package became unavailable for x86_64 in Feb 2017, but it doesn't look like it should have happened. I've asked Alexander who maintains the package in [community].
The AUR doesn't contain an smlnj package because it's against AUR policy to overlap with official packages, unless the AUR package is compiled with some tweak that is clearly visible in the package name.
You can still build an Arch package and install that by finding the PKGBUILD and accompanying files at: https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/smlnj (or by cloning the git repo below with those four files in it):
~ $ git clone https://github.com/sshine/smlnj-arch.git
~ $ cd smlnj-arch
~/smlnj-arch $ makepkg
~/smlnj-arch $ sudo pacman -U smlnj-110.80-3-x86_64.pkg.tar.xz

How to install packages in Linux (CentOS) without root user with automatic dependency handling?

Is it possible to use RPM or YUM or any other package manager in Linux, specifically CentOS, to install a package either already downloaded or from repo to a custom location without admin/root access?
I tried building from sources, using cmake, configure, make, make install etc, but, it ended up having so many dependencies one after other.
Or are there any better alternatives?
It is possible to use yum and rpm to install any package in the repository of the distribution. Here is the recipe:
Find the package name
Use yum search.
Download
Download the package and all of its dependencies using yumdownloader (which is available on CentOS by default). You'll need to pass it --resolve to get dependency resolution. yumdownloader downloads to the current directory unless you specify a --destdir.
mkdir -p ~/rpm
yumdownloader --destdir ~/rpm --resolve vim-common
Choose a prefix location
It might be ~, ~/centos, or ~/y. If your home is slow because it is on a network file system, you can put it in /var/tmp/....
mkdir ~/centos
Extract all .rpm packages
Extract all .rpm packages to your chosen prefix location.
cd ~/centos && rpm2cpio ~/rpm/x.rpm | cpio -id
rpm2cpio outputs the .rpm file as a .cpio archive on stdout.
cpio reads it from from stdin
-i means extract (to the current directory)
-d means create missing directory
You can optionally use -v: verbose
Configure the environment
You will need to configure the environment variable PATH and LD_LIBRARY_PATH for the installed packages to work correctly. Here is the corresponding sample from my ~/.bashrc:
export PATH="$HOME/centos/usr/sbin:$HOME/centos/usr/bin:$HOME/centos/bin:$PATH"
export MANPATH="$HOME/centos/usr/share/man:$MANPATH"
L='/lib:/lib64:/usr/lib:/usr/lib64'
export LD_LIBRARY_PATH="$HOME/centos/usr/lib:$HOME/centos/usr/lib64:$L"
Edited note (thanks to #AmitNaidu for pointing out my mistake):
According to bash documentation about startup files, when connecting to a server via ssh, only .bashrc is sourced:
Invoked by remote shell daemon
Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the remote shell daemon, usually rshd, or the secure shell daemon sshd. If Bash determines it is being run in this fashion, it reads and executes commands from ~/.bashrc, if that file exists and is readable.
Now if you want to install a lot of packages that way, you might want to automate the process. If so, have a look at this repository.
Extra note: if you are trying to install any of gcc, zlib, make, cmake, git, fish, zsh or tmux , you should really consider using conda, see my other answer.
TL;DR Use Miniconda, conda-forge is amazing.
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" | sh
Or, alternatively:
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > Miniconda.sh
bash Miniconda.sh -b -p ~/conda
# -b is used to specify that this is done "in batch", so skip the EULA prompt
# -p lets you specify where you want conda installed
Commonly wanted packages:
gcc conda install gcc
zlib conda install zlib
make conda install make
cmake conda install cmake
git conda install git
fish conda install -c conda-forge fish
zsh conda install -c ActivisionGameScience zsh
tmux conda install -c conda-forge tmux
This tmux has a bug with the name of the ncurse library it uses. You can work around it by going to your da/lib folder and symlinking ln -sT libtinfow.so.6.1 libtinfo.so.6
For the rest, you can try https://anaconda.org/search?q=.
I've tried for a long time to get a package manager to work well on CentOS/RedHat but without success. The best I could do was to install a Gentoo Prefix at the correct location on another CentOS with root access, then scp a .tar.xz of the whole installation to the target server (only way to get a proper gcc for Gentoo Prefix). I could emerge (build & install) packages on the target server but kept hitting problems with locals and permissions.
I recently achieved a user installation of some interesting packages using conda. Here is how to install it from the command line:
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" | sh
If like me, your home folder is hosted on a remote drive (a network file system), you might not want to install it in your home folder, so you might want to use something like mkdir /var/tmp/lo then specify an installation folder like /var/tmp/lo/da during the installation.
You'll then be able to install quite a lot of packages, though maybe not all those you wanted. Most of the time, if it is not in the default channel, it will be in conda-forge. You can check for existing packages at https://anaconda.org/search?q=
Other package managers I've tried to use after conda:
Linuxbrew
I thought that with that it would be easy to install homebrew (linuxbrew) but their sources are messy and use hard-coded absolute path to ruby interpreter, which fails because it isn't the last version and so on and so on and I gave up.
Nix
Nix still requires you to use the /nix folder. They hard-coded it too and it's hard to sed it correctly from every download it has to do during the installation (let alone updates).
Gentoo Prefix
I expect Gentoo Prefix to be easier to install directly now that we gcc can be used on the target server. -- Ok, I tried but met permissions bugs during installation (2018-09-28):
portage.exception.OperationNotPermitted: chown(b'~/gentoo/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.12/image/var', 2000, 2000)
PkgSrc
I'm going to try pkgsrc now. -- Use (older) version 64-bit EL 6.x if on CentOS 6 or if encountering (G)LibC version issues with the 7.x one. -- No luck, pkgsrc hard codes /usr/pkg/sbin and /usr/pkg/bin. So it can't be used as user, unless maybe setting up a fakechroot environment. But I've never done that and I expect usability issues.
Please comment/answer if you succeed in installing any other package manager.
Download the packages, and indicate to include dependencies with the --resolve flag.
yumdownloader --resolve openslide-tools
Iterate over all downloaded rpm files.
for i in *.rpm; do rpm2cpio $i | cpio -idv; done
the output will be stored in your present working directory $PWD/usr/*
This answer by goldilocks sounds like what you are looking for.
https://unix.stackexchange.com/a/61295
It's still not a pretty process, but seems easier than building from source.
Otherwise you might want to look into non-root package managers as an alternative to yum.
Yes it is. If the software is packaged in repos. And admin installed
PackageKit-command-not-found package.
See:
https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound

FFmpeg -bash: ffmpeg: command not found

OK, so I have gone up and down the internet trying to figure out what it is I am doing wrong ... and yet I'm in the middle of nowhere.
I am basically trying to install the FFmpeg on my CENTOS 6.6 dedicated server by following the instructions here: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
Everything seems to go just fine throughout the process. When it's all done, I type in "ffmpeg" hit the enter and keep on getting this extremely ugly error:
-bash: -bash:: command not found
I'm not much of a shell guy, but working with it all day today, I can say that this means that it's not installed correctly. So, I tried re-installing it, and it tells me all the packages already exist now ... . Here is a copy if what I am doing and what I am getting:
root#server1 [~]# ffmpeg -version
-bash: ffmpeg: command not found
root#server1 [~]# yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
Loaded plugins: fastestmirror, priorities, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.mirror.ndchost.com
* extras: centos-distro.cavecreek.net
* updates: mirrors.easynews.com
Package autoconf-2.63-5.1.el6.noarch already installed and latest version
Package automake-1.11.1-4.el6.noarch already installed and latest version
Package gcc-4.4.7-11.el6.x86_64 already installed and latest version
Package gcc-c++-4.4.7-11.el6.x86_64 already installed and latest version
Package git-1.7.1-3.el6_4.1.x86_64 already installed and latest version
Package libtool-2.2.6-15.5.el6.x86_64 already installed and latest version
Package 1:make-3.81-20.el6.x86_64 already installed and latest version
Package nasm-2.07-7.el6.x86_64 already installed and latest version
Package 1:pkgconfig-0.23-9.1.el6.x86_64 already installed and latest version
Package zlib-devel-1.2.3-29.el6.x86_64 already installed and latest version
Nothing to do
Any ideas or help is greatly appreciated!
OK, after paying more attention, I realized that there was an error
Unable to create and execute files in /tmp. Set the TMPDIR environment
variable to another directory and make sure that it is not mounted noexec.
Sanity test failed.
So, I just made the /tmp directory and ran this:
export TMPDIR=$HOME/tmp
And then ran the installation command!

Resources