I am creating my first package using RPM on ubuntu machine.But I am getting so many difficulties.I tried so many commands to install rpmdevtools using "yum" but it is giving error as There are not repos enabled.
When I try to install it using apt-get it gives error as Unable to locate the package.
Can anybody suggest the proper start to end procedure with commands to build a package using RPM?
rpmdev is mostly optional. rpm is enough. The following describes the minimum steps to package a script program into a RPM file on Debian.
Install rpmbuild:
apt-get install rpm
Create a helloworld program:
cat > helloworld <<EOF
#! /bin/bash
printf "Hello World!\n"
EOF
chmod +x helloworld
Create a minimal specification helloworld.spec:
Name: helloworld
Version: 1.0
Release: 1%{?dist}
Summary: Hello World
License: GPLv3+
BuildArch: noarch
%description
Hello World!
%prep
%build
%install
mkdir -p %{buildroot}/%{_bindir}
install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name}
%files
%{_bindir}/%{name}
%changelog
Build the RPMs:
rpmbuild -ba --build-in-place --define "_topdir $(pwd)/rpm" helloworld.spec
mv rpm/SRPMS/*.rpm .
mv rpm/RPMS/*/*.rpm .
rm -rf rpm
But you will not be able to install it on Debian or Ubuntu. The installation requires Fedora or Red Hat.
Related
Trying to generate rpm on RHEL8 Machine. The same rpm_build.sh script works fine on RHEL6 & RHEL7. But in RHEL 8 its failing to generate debuginfo packages.
RPM BUILD VERSION :
$ sudo yum install rpm-build
Package rpm-build-4.14.3-23.el8.x86_64 is already installed.
+ install -m 755 libclntshcore.so.12.1 /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
+ install -m 755 libnnz12.so /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libnnz12.so
/usr/lib/rpm/find-debuginfo.sh -j8 --strict-build-id -m -i --build-id-seed 23.1.3-1.el8 --unique-debug-suffix -23.1.3-1.el8.x86_64 --unique-debug-src-base my_lib-23.1.3-1.el8.x86_64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 -S debugsourcefiles.list /home/opc/rpmbuild/BUILD/my_lib-23.1.3
extracting debug info from /home/opc/rpmbuild/BUILDROOT/my_lib23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
extracting debug info from /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libnnz12.so
gdb-add-index: No index was created for /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libons.so
gdb-add-index: [Was there no debuginfo? Was there already an index?]
gdb-add-index: No index was created for /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
gdb-add-index: [Was there no debuginfo? Was there already an index?]
My Spec.file
Name: my_lib-devel
Version: %{pkg_version}
Release: %{pkg_release}%{?dist}
Group: System Environment/Libraries
Source0: %{_sourcedir}/%{name}-%{version}.tar.gz
Requires: my_lib
%global debug_package %{nil}
%global _lib_authn_api_filename libauthn_api.so
%global _package_name my_lib
%description
developemnt package
%prep
%setup -q
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%build
%install
mkdir -p %{buildroot}/%{_includedir}/%{_package_name}
mkdir -p %{buildroot}%{_datadir}/doc/%{name}
cp *.h %{buildroot}/%{_includedir}/%{_package_name}
install -m 644 README %{buildroot}%{_datadir}/doc/%{name}/README
install -m 644 LICENCE %{buildroot}%{_datadir}/doc/%{name}/LICENCE
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
/%{_includedir}/%{_package_name}/*.h
%doc %{_datadir}/doc/%{name}/*
Not sure why it complaints while extracting debug info
When I ran it on RHEL6 / RHEL7 same thing works fine . Is something is updated in RHEL8 which I'm missing or do I need to update the specs to work on RHEL8 . I have tried couple of solution Like %global debug_package %{nil} or %define debug_package %{nil} But nothing works.
Kindly Help !
I have Ubuntu 16.04 (on Docker) and wanted to connect to remote Oracle DB using Python. For that - using cx_oracle module.
Tried:
pip install cx_oracle
--> Complained about libaio1 and libaio-dev missing..
apt-get install libaio1 libaio-dev
--> Complained again:
cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "libclntsh.so: cannot open shared object file: No such file or directory"
Is there a one command to install cx_Oracle properly on Ubuntu 16.04 (or need to do all from source manually -> trying to automate all steps...)?
Thanks.
Did not find (yet) easy way but this is what I did:
This just worked for me on Ubuntu 16:
Download ('instantclient-basic-linux.x64-12.2.0.1.0.zip' and 'instantclient-sdk-linux.x64-12.2.0.1.0.zip') from Oracle web site and then do following script (you can do piece by piece and I did as a ROOT):
apt-get install -y python-dev build-essential libaio1
mkdir -p /opt/ora/
cd /opt/ora/
## Now put 2 ZIP files:
# ('instantclient-basic-linux.x64-12.2.0.1.0.zip' and 'instantclient-sdk-linux.x64-12.2.0.1.0.zip')
# into /opt/ora/ and unzip them -> both will be unzipped into 1 directory: /opt/ora/instantclient_12_2
rm -rf /etc/profile.d/oracle.sh
echo "export ORACLE_HOME=/opt/ora/instantclient_12_2" >> /etc/profile.d/oracle.sh
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME" >> /etc/profile.d/oracle.sh
chmod 777 /etc/profile.d/oracle.sh
source /etc/profile.d/oracle.sh
env | grep -i ora # This will check current ENVIRONMENT settings for Oracle
rm -rf /etc/ld.so.conf.d/oracle.conf
echo "/opt/ora/instantclient_12_2" >> /etc/ld.so.conf.d/oracle.conf
ldconfig
cd $ORACLE_HOME
ls -lrth libclntsh* # This will show which version of 'libclntsh' you have... --> needed for following line:
ln -s libclntsh.so.12.1 libclntsh.so
pip install cx_Oracle # Maybe not needed but I did it anyway (only pip install cx_Oracle without above steps did not work for me...)
Now python scripts are ready to use 'cx_Oracle'.
Is there the equivalent of ILDASM / ILASM for the .net-core?
Specifically, I'm looking for something that runs on Linux (Hence why the .net-core).
Both the ildasm and ilasm tools are built with CoreCLR from this repo: https://github.com/dotnet/coreclr. They include similar functionality as the versions shipped with Windows (sans GUI, etc.).
There are nuget packages shipped that include them as well (https://www.nuget.org/packages?q=ildasm), but they are platform-specific and also require a matching version of CoreCLR to use, so they are not straightforward to consume via nuget. The easiest way to run these on your platform is to just build them from source from the coreclr repo.
It does not appear there is a native Microsoft tool that serves these functions on Linux and it is not currently built into the dot-net-core.
However, Mono allows the assembly and disassembly of IL code:
Installation Instructions can be found here.
What you are looking for is:
ilasm - For assembling
monodis - For disassembling
These are found in the package mono-utils:
e.g. On Debian 8 I did the following:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian jessie" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
apt-get install mono-devel mono-utils
However, FYI, for those trying to create exports, Mono does not appear to handle the x64 export syntax.
Let's 'install' ildasm tool using related nuget-package:
define RID (Runtime Identifier)
dotnet --info
# execution result
..
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64 # <----
..
download the package runtime.{RID}.Microsoft.NETCore.ILDAsm. For my case it is: runtime.ubuntu.18.04-x64.Microsoft.NETCore.ILDAsm
unarchive it and extract executable file '/runtimes/{RID}/native/ildasm'
grant it execution permission and copy to .NET runtime folder (call dotnet --list-runtimes to list runtimes)
chmod +x ildasm
sudo mv ildasm /usr/share/dotnet/shared/Microsoft.NETCore.App/{version}/
create symlink
ln -s /usr/share/dotnet/shared/Microsoft.NETCore.App/{version}/ildasm ildasm
run ildasm
./ildasm {path}/project.dll >> {path}/project.il
The same steps are applicable for ilasm.
As an alternate way consider using dotnet-ildasm tool:
# install .net core runtime if required
# sudo apt-get update; \
# sudo apt-get install -y apt-transport-https && \
# sudo apt-get update && \
# sudo apt-get install -y dotnet-runtime-3.0
# find required tool
dotnet tool search ildasm
# output:
# Package ID Latest Version Authors Downloads Verified
# ---------------------------------------------------------------------------
# dotnet-ildasm 0.12.2 pjbgf 100154
# dotasm 1.0.1 DotAsm 434
# install tool
dotnet tool install -g dotnet-ildasm
Output IL to file:
# go to project folder
cd ../project/bin/Debug/netx.x
dotnet ildasm program.dll -o program.il
I'm trying to install Cppcheck via telnet on a Linux box. I have the cppcheck-1.67.tar file and I untar it. I don't see anything that will install it for me. Am I approaching this the correct way?
Actual on a date publication of this answer.
Download file from there https://sourceforge.net/projects/cppcheck/
Go to the folder with for downloads
cd ~/Downloads/
Unpack archive
tar -xvf cppcheck-1.76.1.tar.bz2
Go to unpacked folder
cd cppcheck-1.76.1/
Install package as root
sudo make install
Check up result
$ which cppcheck
/usr/bin/cppcheck
Testing it
$ touch simple.c
$ echo "int main(){ int a; a + 1; return 0}" > simple.c
$ cppcheck simple.c
Checking simple.c ...
[simple.c:1]: (error) Uninitialized variable: a
This package also exists in a standard repository.
$ aptitude search cppcheck
p cppcheck - tool for static C/C++ code analysis
Testing environment
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
$ uname -a
Linux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
The instructions are in the readme.txt file. The short answer is make install.
Remember never to install things from a tar file when you can use your distribution's package manager.
The readme.txt file makes no mention of "make install".
It looks like the supplied Makefile is borked:
It passes "CFG=" param to compile, without DESTDIR
But "make install" prepends DESTDIR to CFGDIR
In my case, I edited Makefile to remove DESTDIR from make install, and cppcheck is happy with that.
For me the magic lines turned out to be the following in Docker on Ubuntu 18.04 (Bionic Beaver):
RUN cd /tmp \
&& git clone https://github.com/danmar/cppcheck.git \
&& cd cppcheck \
&& git checkout 1.72 \
&& make SRCDIR=build CFGDIR=/usr/bin/cfg HAVE_RULES=yes install \
&& cd /tmp \
&& rm -rf /tmp/cppcheck \
&& ldconfig
I assume the following will work for any version. I am not sure where it makes sense to install the configuration to. This works for me:
make SRCDIR=build CFGDIR=/usr/bin/cfg HAVE_RULES=yes install
If you want a later version than in the other answers, and you want to install it, then you can use the bash script below which is up to date and builds on the other answers. It should also clean itself up afterwards. It works for version 2.7 on debian/ubuntu but you can change the git checkout tag and try your luck on newer versions.
installcppcheck.sh
#!/usr/bin/env bash
set -e
cd /tmp
git clone https://github.com/danmar/cppcheck.git
cd cppcheck
git checkout 2.7
make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" install
cd /tmp
rm -rf /tmp/cppcheck
ldconfig
cppcheck --version
If you don't have sudo privileges you can follow #Seti Volkylany's answer, replacing step 5 with
OUT_PATH=/home/user/bin # target location of binary
make SRCDIR=build CFGDIR=~/Downloads/cppcheck-1.76.1/cfg PREFIX=$OUT_PATH
make install CFGDIR=$OUT_PATH/cppcheck-1.76.1/cfg PREFIX=$OUT_PATH
Could someone pls give me a detailed procedure to intsall libs3 on LINUX? Just the procedure will do.
Thanks in advance.
These are the instructions to install libs3 on centos on a 64 bit machine.
According to their README, you are supposed to build an rpm package out of their source code using 'rpmbuild -ta '
1.) So first, install rpmbuild if it isn't installed already. [My install location is the default one: ~/rpmbuild]
2.) Clone libs3.
git clone https://github.com/bji/libs3.git
3.) Rename folder as libs3-trunk [rpmbuild complained if its name wasn't that, so...], create a tar.gz, copy it to SOURCES folder inside rpmbuild directory.
mv libs3 libs3-trunk
tar -zcvf libs3-trunk.tar.gz libs3-trunk/
mv libs3-trunk.tar.gz ~/rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
4.) Build the rpm
rpmbuild -ta libs3-trunk.tar.gz
cd ../RPMS/x86_64
5.) Install dependency libs3-2-2.0-5.1.x86_64.rpm from
[http://rpm.pbone.net/index.php3/stat/4/idpl/21900926/dir/centos_6/com/libs3-2-2.0-5.1.x86_64.rpm.html] OR [ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/dalgaaf:/ceph:/extra/CentOS_CentOS-6/x86_64/libs3-2-2.0-5.1.x86_64.rpm]
6.) Install the rpm:
Execute following as sudo:
rpm -Uvh libs3-2-2.0-5.1.x86_64.rpm
rpm -Uvh --replacefiles libs3-trunk-1.x86_64.rpm
rpm -Uvh libs3-devel-trunk-1.x86_64.rpm
7.) Install libcurl-devel/libxml2-devel through yum if you get following error:
make: curl-config: Command not found
make: xml2-config: Command not found
sudo yum install libcurl-devel.x86_64
sudo yum install libxml2-devel.x86_64
For ubuntu versions >=14.04, libs3-dev is available as an Ubuntu package.
So you just need to run:
sudo apt-get install libs3-dev