Install Mercurial and TortoiseHG on CentOS 6.5 - mercurial

How to install Mercurial and TortoiseHG on CentOS 6.5?
This is not trivial, as there is no official RPM for this.
See procedure as a bash script below.
I hope this helps

This procedure is a joining of instructions from several locations.
Create a script with the content below and run it as root.
#!/bin/bash
# Installation of mercurial and TortoiseHG
APPS_BASE=/opt
HG_BIN=$APPS_BASE/bin
HG_REPOS=$APPS_BASE/repos
checkResult()
{
if [ $1 -ne 0 ]
then
echo;echo ERROR: $2 failed;echo
exit 1
else
echo;echo Action $2 OK;echo
fi
}
######### Start here #########
echo;echo Adding epel-release repository
yum -y install http://ftp.uninett.no/linux/epel/6/i386/epel-release-6-8.noarch.rpm
checkResult $? "yum install epel-release"
# Get more prereq packages
echo;echo Install some more packages needed
yum -y install PyQt4-devel python-devel python-iniparse gcc gettext
checkResult $? "yum install PyQt4-devel python-devel python-iniparse gcc gettext"
yum --enablerepo=epel -y install qscintilla-python python-keyring python-sphinx Django
checkResult $? "yum install qscintilla-python python-keyring python-sphinx Django"
# Install Mercurial from source to bootstrap
echo;echo Get and install Mercurial from source
mkdir $HG_BIN $HG_REPOS
cd $HG_REPOS
wget https://www.mercurial-scm.org/release/mercurial-2.4.2.tar.gz
checkResult $? "wget for mercurial"
tar xzvf mercurial-2.4.2.tar.gz
cd mercurial-2.4.2/
make local
checkResult $? "make local for mercurial"
# Get a Mercurial clone, to stay up to date
echo;echo Get and install Mercurial stable
./hg clone https://www.mercurial-scm.org/repo/hg#stable ../hg
checkResult $? "hg clone https://www.mercurial-scm.org/repo/hg#stable"
cd ../hg
make local
checkResult $? "make local for mercurial stable"
echo;echo Create link for hg
cd $HG_BIN
ln -s $HG_REPOS/hg/hg .
# now get a TortoiseHg clone
echo;echo Get the TortoiseHG
cd $HG_REPOS
$HG_BIN/hg clone https://bitbucket.org/tortoisehg/thg thg
checkResult $? "hg clone https://bitbucket.org/tortoisehg/thg"
echo;echo Create links for thg
cd thg
ln -s ../hg/mercurial/
ln -s ../hg/hgext/
cd $HG_BIN
ln -s $HG_REPOS/thg/thg .
echo;echo Install kdiff3
yum -y install kdiff3
checkResult $? "yum install kdiff3"
# Cleanup
echo;echo Cleanup
rm -rf $HG_REPOS/mercurial-2.4.2/ $HG_REPOS/mercurial-2.4.2.tar.gz
echo;echo Add $HG_BIN to path
echo "export PATH=$HG_BIN:$PATH" >> /etc/profile
Once this is done, you will have two links
/opt/bin/hg - mercurial
/opt/bin/thg - tortoiseHg
Of course you can easily move things around as you see fit.
EDIT: If anyone has an idea on how to get the nautilus extensions working, please add here!
EDIT 2: (Contributed by #Will-I-am-davidon). Needed to install some more packages to get the thg working: yum install PyQt qscintilla qscintilla-python

Didnt work for me sorry !!! After having been spent 2 Hours finding the issue for "incorrect data format" I just removed checkSum() and everywhere below wrote ECHO
it worked for me 100%
THANKs =)

In my case i wanna update my production server with a project of my own hosted in BitBucket.org, so you try as i did with Installing on CentOS 6.3

As outlined in Mercurial Download, create /etc/yum.repos.d/mercurial.selenic.com.repo and paste in the following:
[mercurial.selenic.com]
name=mercurial.selenic.com
baseurl=https://www.mercurial-scm.org/release/centos$releasever
enabled=1
# Temporary until we get a serious signing scheme in place,
# check https://www.mercurial-scm.org/wiki/Download again
gpgcheck=0
Then you can issue the command sudo yum install hg.

Related

Using APT after installing package by DPKG

As I know "dpkg -i package.deb" installs given package. But why in this case after dpkg, apt is used for installing zabbix modules? Should`t it be installed by DPKG?
# wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb
# dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb
# apt update
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
APT download the given modules from the repository. However, these modules can also be installed using DPKG by downloading the package manually from any repo.
Download it from
http://mirror.nullivex.com/zabbix/4.5/pool/main/z/zabbix/
and simply install it via dpkg -i package.deb.
Download all the packages like zabbix-server-mysql http://mirror.nullivex.com/zabbix/4.5/pool/main/z/zabbix/zabbix-server-mysql_5.0.0~rc1-1+jessie_amd64.deb
And simply install it via dpkg.

Installing Connector C for Mariadb

So, I want to use Mariadb. There is this Connector-C for it.
https://downloads.mariadb.org/connector-c/
How do I install it? Quiet frankly, the documentation for it is horrible. Even the src file for 3.0.5 is linked to 3.0.4 page.
I did not find a way to install the binary, and the documentation for building from src is quiet vague. I would prefer to know how to install both ways (binary and build from source)
I'm using CentOS7 64bit.
The easiest way to install it would be to use the MariaDB package repository.
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
sudo yum -y install MariaDB-devel
As for building from source, these steps should work on CentOS 7.
sudo yum -y install git gcc openssl-devel make cmake
git clone https://github.com/MariaDB/mariadb-connector-c.git
mkdir build && cd build
cmake ../mariadb-connector-c/ -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
And for Ubuntu 20.04...
sudo apt-get install libmariadb3 libmariadb-dev
Raspberry Pi OS
cd to preferred build location. Then install (thanks to #markusjm!):
sudo apt install git gcc make cmake libssl-dev
git clone https://github.com/MariaDB/mariadb-connector-c.git
mkdir build && cd build
cmake ../mariadb-connector-c/ -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
Then add installation directory to LD_LIBRARY_PATH. Note: my installation directory is /usr/lib/mariadb. If you cannot find this after your installation, search for e.g. libmariadb.so, a file that should reside in your installation folder.
export LD_LIBRARY_PATH=/usr/lib/mariadb:$LD_LIBRARY_PATH
Afterwards you can finally pip3 install mariadb, if, like me, you tried to do that in the first place.
After you download MariaDB Connector/C, untar and cd. Then mv the executable first.
sudo mv -f bin/mariadb_config /usr/bin/
Now you can execute mariadb_config and will know where to put header and library files to build wheel for mariadb.
For example,
Ubuntu 18.04
sudo mv -f include/mariadb /usr/local/include/
sudo mv -f lib/mariadb /usr/local/lib/
CentOS 7 & Ubuntu 20.04
sudo mv -f include/mariadb /usr/include/
sudo mv -f lib/mariadb /usr/lib/
Finally, you could pip install mariadb. (Or, export CFLAGS=-std=c99 may help.)
After, in the case you cannot import mariadb,
export LD_LIBRARY_PATH=/PATH/TO/where/you/mv/lib/mariadb

How to use command line dpkg options to unpack conf and skip postinst script

I have a need to run dpkg install, unpack the conf files, but skip running the postinst scripts (if it's included in the deb file).
I've tried to change the SHELL variable to /usr/bin/true, but that didn't work. Any other ideas would be great!
According to its man-page dpkg doesn't have a command-line-option to disable script execution. However, you can achieve what you want with the following commands (taken from this answer from an ubuntu forum):
apt-get download <package>
sudo dpkg --unpack <package>*.deb
sudo rm /var/lib/dpkg/info/<package>.postinst -f
sudo dpkg --configure <package>
sudo apt-get install -yf #To fix dependencies

Cygnus installation

I try to install cygnus. I install yum install java-1.6.0-openjdk-devel and run , my problem is:
Then, the developed classes must be packaged in a Java jar file which must be added to the APACHE_FLUME_HOME/lib directory:
$ git clone https://github.com/telefonicaid/fiware-connectors.git
$ git checkout release/0.1
$ cd fiware-connectors/flume
$ APACHE_MAVEN_HOME/bin/mvn package
$ cp target/cosmos-injector-1.0-SNAPSHOT.jar APACHE_FLUME_HOME/lib
in this step, I create cygnus.jar not cosmos-injector-1.0-SNAPSHOT.jar , and # APACHE_FLUME_HOME/conf/cosmos-injector.conf not exist on my flume directory.
Alejandro, I recommend you to install last version of Cygnus (currenty, 0.7.1), which can be installed through RPM packages (recommended). Simply configure the FIWARE repo and install it using yum (CentOS):
$ sudo cat > /etc/yum.repos.d/fiware.repo <<EOL [Fiware]
name=FIWARE
repository baseurl=http://repositories.testbed.fi-ware.eu/repo/rpm/x86_64/
gpgcheck=0
enabled=1
EOL
$ yum install cygnus
You can find the Cygnus Quick Start Guide at this link.
The README will give you extended information about the tool.
Advanced topics can be found at the doc/ folder.

How to download all dependencies and packages to directory

I'm trying to install a package on a machine with no Internet connection. What I want to do is download all the packages and dependences on a machine WITH an Internet connection and then sneaker-net everything to the offline computer.
I've been playing with the apt-get and apt-cache but I haven't figured out a quick and easy way to download the package and dependencies in one swoop to a directory of my choosing. How would I do this? Am I going about this problem correctly?
How would you install offline packages that have a lot of dependencies?
The marked answer has the problem that the available packages on the machine that is doing the downloads might be different from the target machine, and thus the package set might be incomplete.
To avoid this and get all dependencies, use the following:
apt-get download $(apt-rdepends <package>|grep -v "^ ")
Some packages returned from apt-rdepends don't exist with the exact name for apt-get download to download (for example, libc-dev). In those cases, filter out those exact names (be sure to use ^<NAME>$ so that other related names, for example libc-dev-bin, that do exist are not skipped).
apt-get download $(apt-rdepends <package>|grep -v "^ " |grep -v "^libc-dev$")
Once downloaded, you can move the .deb files to a machine without Internet and install them:
sudo dpkg -i *.deb
Same question already answered here:
How to list/download the recursive dependencies of a debian package?
try:
PACKAGES="wget unzip"
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \
--no-conflicts --no-breaks --no-replaces --no-enhances \
--no-pre-depends ${PACKAGES} | grep "^\w")
# aptitude clean
# aptitude --download-only install <your_package_here>
# cp /var/cache/apt/archives/*.deb <your_directory_here>
The aptitude --download-only ... approach only works if you have a debian distro with internet connection in your hands.
If you don't, I think it is better to run the following script on the disconnected debian machine:
apt-get --print-uris --yes install <my_package_name> | grep ^\' | cut -d\' -f2 >downloads.list
move the downloads.list file into a connected linux (or non linux) machine, and run:
wget --input-file myurilist
this downloads all your files into the current directory.After that you can copy them on an USB key and install in your disconnected debian machine.
Credits: http://www.tuxradar.com/answers/517
This will download all the Debs to the current directory, and will NOT fail if It can't find a candidate.
Also does NOT require sudo to run sript!
nano getdebs.sh && chmod +x getdebs.sh && ./getdebs.sh
#!/bin/bash
package=ssmtp
apt-cache depends "$package" | grep Depends: >> deb.list
sed -i -e 's/[<>|:]//g' deb.list
sed -i -e 's/Depends//g' deb.list
sed -i -e 's/ //g' deb.list
filename="deb.list"
while read -r line
do
name="$line"
apt-get download "$name"
done < "$filename"
apt-get download "$package"
Note: I used this as my example because I was actually trying to DL the Deps for SSMTP and it failed on debconf-2.0, but this script got me what I need!
Somewhat simplified (and what worked for me) way that worked for me (based on all the above)
Note that dependencies hierarchy can go deeper then one level
Get dependencies of your package
$ apt-cache depends mongodb | grep Depends:
Depends: mongodb-dev
Depends: mongodb-server
Get urls:
sudo apt-get --print-uris --yes -d --reinstall install mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-tools | grep "http://" | awk '{print$1}' | xargs -I'{}' echo {} | tee files.list
wget --input-file files.list
I used apt-cache depends package to get all required packages in any case if the are already installed on system or not.
So it will work always correct.
Because the command apt-cache works different, depending on language, you have to try this command on your system and adapt the command.
apt-cache depends yourpackage
On an englisch system you get:
$ apt-cache depends yourpackage
node
Depends: libax25
Depends: libc6
On an german system you get:
node
Hängt ab von: libax25
Hängt ab von: libc6
The englisch version with the term:
"Depends:"
You have to change the term "yourpackage" to your wish twice in this command, take care of this!
$ sudo apt-get --print-uris --yes -d --reinstall install yourpackage $(apt-cache depends yourpackage | grep " Depends:" | sed 's/ Depends://' | sed ':a;N;$!ba;s/\n//g') | grep ^\' | cut -d\' -f2 >downloads.list
And the german version with the term:
"Hängt ab von:"
You have to change the term "yourpackage" to your wish twice in this command, take care of this!
This text is used twice in this command, if you want to adapt it to your language take care of this!
$ sudo apt-get --print-uris --yes -d --reinstall install yourpackage $(apt-cache depends yourpackage | grep "Hängt ab von:" | sed 's/ Hängt ab von://' | sed ':a;N;$!ba;s/\n//g') | grep ^\' | cut -d\' -f2 >downloads.list
You get the list of links in downloads.list
Check the list, go to your folder and run the list:
$ cd yourpathToYourFolder
$ wget --input-file downloads.list
All your required packages are in:
$ ls yourpathToYourFolder
This will download all packages and dependencies (no already installed) to a directory of your choice:
sudo apt-get install -d -o Dir::Cache=/path-to/directory/apt/cache -o Dir::State::Lists=/path-to/directory/apt/lists packages
Make sure /path-to/directory/apt/cache and /path-to/directory/apt/lists exist.
If you don't set -o Dir::Cache it points to /var/cache/apt,
Dir::State::Lists points to /var/lib/apt/lists (which keeps the index files of available packages)
Both -o options can be used with update and upgrade instead of install.
On different machine run the same command without '-d'
I'm assuming you've got a nice fat USB HD and a good connection to the net. You can use apt-mirror to essentially create your own debian mirror.
http://apt-mirror.sourceforge.net/
On modern Ubuntu systems (for example, 22.04):
apt clean
apt update
apt install --download-only freeipa-client
After you can find deb-files in
ls -l /var/cache/apt/archives/
IF you accept the caveat that there may be dependencies already installed on your system, then the easiest way is to go apt-get install --simulate <your_package>, this will first list all the deps it will install, then copy the list of packages, then apt-get download <the_list_of_packages>
e.g. for qt5-gtk2-platformtheme on a xubuntu-21.04 MINIMAL INSTALL you'll get (after apt-get install --simulate) the following:
libdouble-conversion3 libmd4c0 libpcre2-16-0 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5svg5 libqt5widgets5 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxkbcommon-x11-0 qt5-gtk-platformtheme qttranslations5-l10n
then you just cd in a folder of your choice, do apt-get download <the_list_above>, and you have them all d/w in there. you can then dpkg -i *.deb
Complementing and automating the exclusion of ALL conflictive dependencies (dependencies not found) by the command given by #onno:
apt-get download $(apt-rdepends <package>|grep -v "^ " |grep -v "^conflictiv-dependency$")
At least for Ubuntu, where the Error Message format is as follows:
E: Can't select candidate version from package <package> as it has no candidate
The following script Downloads all Found Dependencies, Excluding not Found ones:
#!/bin/bash
rm -f error.txt
apt download $(apt-rdepends $1 | grep -v "^ ") 2> error.txt
#IF THERE WAS ERRORS (DEPENDENCIES NOT FOUND)
if [ $(cat error.txt | wc -l) -gt 0 ]
then
partial_command="\("
while read -r line
do
conflictive_package="$(awk '{split($0,array," "); print array[8]}' <<< $line)"
partial_command="$partial_command$conflictive_package\|"
done < error.txt
partial_command="$(awk '{print substr($0, 1, length($0)-2)}' <<< $partial_command)\)"
eval "apt download \$(apt-rdepends $1 | grep -v '^ ' | grep -v '^$partial_command$')"
fi
rm error.txt
It works with me
sudo apt-get reinstall --download-only <your software>
for example
sudo apt-get reinstall --download-only ubuntu-restricted-extras
For accessing installed .deb files, you can look in this path:
/var/cache/apt/archives