Create .deb file from c source file - unix

I have a C program and I want to buid it into deb file to install it. Can you show me how to do it? Thanks so much for helping.

This guide demonstrates how to create a debian package
https://wiki.debian.org/HowToPackageForDebian

Generate a gpg key. Remember the NAME and the EMAIL_ADDRESS you enter.
gpg --gen-key
gpg -a --output ~/.gnupg/ANY_NAME.gpg --export 'YOUR NAME'
gpg --import ~/.gnupg/ANY_NAME.gpg
Then, having installed the necessary packages for building C libraries:
sudo apt-get install build-essential autoconf automake \
autotools-dev dh-make debhelper devscripts fakeroot \
xutils lintian pbuilder pkg-config
move to your C project folder. And run: (enter -s for single binary pkg when prompted )
dh_make -e EMAIL_ADDRESS -f path/to/file.orig.tar.gz
You will see a debian folder with generated files. From those,you should edit as your pkg needs the files control, copyright and changelog files.
Then build the package:
dpkg-buildpackage -rfakeroot
If no errors the package .deb is generated.
Further guides on how to do this here:
- https://askubuntu.com/questions/1345/what-is-the-simplest-debian-packaging-guide
- https://linuxconfig.org/easy-way-to-create-a-debian-package-and-local-package-repository
- https://coderwall.com/p/urkybq/how-to-create-debian-package-from-source

Related

Jupyterlab - find and replace globally ( all files and in all directories )

Is there any way to find and replace text string automatically in all folder's files? similar to what we get in sublime text, VS code etc
In JupyterLab you can open a terminal. Depending on the OS you use, you can use the tools from that OS to do the job. On Linux for example you can use find and sed to replace:
find path/to/folder -type f -exec sed -i 's/replace this/with this/g' {} \;
Other than that I do not think that this is a built-in functionality in JupyterLab.
You can install jupyterlab-search-replace extension, for example with pip:
pip install jupyterlab-search-replace
and the required ripgrep, for example on Ubuntu:
sudo apt-get install ripgrep
If you use a conda environment you can just install both with:
conda install -c conda-forge jupyterlab-search-replace ripgrep
For up-to-date installation instructions see the GitHub repository of the extension.
This extension requires JupyterLab 3 or newer.

Could not find header file for OPENSSL

I am trying to install Luasec on Ubuntu terminal, but it just keeps displaying this error to me:
Error: Could not find header file for OPENSSL
No file openssl/ssl.h in /usr/local/include
No file openssl.h/ssl.h/ in /usr/include
No file openssl/ssl.h in /include
You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.
When I check OpenSSL version it says its 1.1.1f
So how do I proceed?
sudo apt -y install libssl-dev
Despite the lowercase l this solution works for me (independent of what some responders told here)
luarocks install openssl
Fixed the issue by Installing OpenSSL with terminal through Luarocks with the command:
Luarocks install openssl
And now after installing it, it works.

How to install R from tar gz file

I have R in 3.6.3 version and I want to download 4.0.0 version. I downloaded from https://cran.r-project.org/src/base/R-4/ tar gz file but I have no idea how can I install it. Could you please give me a command which can install this R version from tar gz file ?
Install R from Source on Linux
You can find a detailed description for a range of different Linux systems here.
In short, you will need to run the following chain of commands:
First to install dependencies. This will depend on your Linux distribution. For Linux Mint, you can do
sudo apt-get build-dep r-base
Then, specify your desired R version
export R_VERSION=4.2.1
In a folder of your choice, download the .tar.gz (For versions other than 4.X, you may need to adjust the link)
curl -O https://cran.rstudio.com/src/base/R-4/R-${R_VERSION}.tar.gz
tar -xzvf R-${R_VERSION}.tar.gz
cd R-${R_VERSION}
To build and install, run from the same shell
./configure \
--prefix=/opt/R/${R_VERSION} \
--enable-memory-profiling \
--enable-R-shlib \
--with-blas \
--with-lapack
make
sudo make install
In case the ./configure ... step does not work out, you may need to install the missing binaries individually by hand.
You can check the installation by running
/opt/R/${R_VERSION}/bin/R --version
and create a symlink
sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
Done!
Your R installation will be in
/opt/R/${R_VERSION}

./configure: error: the HTTP gzip module requires the zlib library

I am new to dockers/containers.
I am trying to run a fork with a fix I have put in for openSSL vulnerability of mup-frontend using the following command:
docker build ./
It compiles to a point then errors with
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
I am running a mac so installed zlib with brew. I have searched long and hard but cannot find much on this error.
Because of this error it also fails to build on automation in docker.io
The Dockerfile you reference at
https://github.com/meteorhacks/mup-frontend-server/blob/master/Dockerfile
starts with
FROM debian
so you will need to have such a line in your Dockerfile, before the place where you need zlib
RUN apt-get update && apt-get install -y \
zlib \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
in one RUN, you update, install and clean
yum install -y httpd-devel pcre perl pcre-devel zlib zlib-devel GeoIP GeoIP-devel
Download required packages
cd
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz
wget http://zlib.net/zlib-1.2.5.tar.gz
wget ftp://ftp.openssl.org/source/openssl-0.9.8o.tar.gz
Now you have to untar these files.
tar -xvf zlib-1.2.5.tar.gz
tar -xvf pcre-8.10.tar.gz
tar -xvf openssl-0.9.8o.tar.gz

nginx install on linux

I downloaded nginx from it's site for linux(I use ubuntu 10.4).I extracted nginx-1.0.6.tar.gz and there was a configure file in that directory. So I entered "./configure" command in shell. It seemed to be configured right.After I entered "make" command ,It said this error:
make -f objs/Makefile
make[1]: Entering directory `/usr/local/nginx'
cd ./auto/lib/pcre/ \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared
/bin/sh: ./configure: not found
make[1]: *** [auto/lib/pcre//Makefile] Error 127
make[1]: Leaving directory `/usr/local/nginx'
make: *** [build] Error 2
what should I do now?
you have to install Dependencies .
generally these will be enough
libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
so you can first install them
sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
and then compile .. also make sure you run the make command as root.
The ./configure program of nginx wants to find either the shared libs to build nginx dynamicaly linked or the sources of openssl prce and zlib respectivly.
The obove mentioned error occurs when you invoke ../nginx/configure with the wrong options.
--with-pcre=/path/to/lib # where libpcre.a resides
--with-openssl=/path/to/lib # where libssl.a resides
--with-zlib=/path/to/lib # where libz.a resides
is wrong especially when ld.so has no idea about these libs
If you build a statically linked version of nginx
try instead
--with-pcre=/path/to/src/of/pcre
--with-openssl=/path/to/src/of/openssl
--with-zlib=/path/to/src/of/zlib
e.g.
--with-pcre=../pcre-8.36 --with-openssl=../openssl-1.0.2 --with-zlib=../zlib-1.2.8
Download PCRE from source
Unzip it (do not install)
Copy this path to configure (from Downloads folder)
./configure --with-pcre=/home/USER/DOWNLOADS/pcre-8.37/
Enter your nginx install directory - I solved this error by editing objs/Makefile and removing -Wall and -Werror params so it looks like this (second line):
CC = gcc
CFLAGS = -pipe -O -W -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -g
Also, running your ./configure should initiate a long procedure of verifications to ensure
that your system contains all the necessary components. If the configuration fails for any reason, check
less objs/autoconf.err
for more details. Any errors at configuration are usually based on missing dependencies for your configuration.
You didn't configure it right. Use these commands (in the nginx directory):
./configure --with-pcre=./auto/lib/pcre/ --with-zlib=./auto/lib/zlib/
./configure
make
sudo make install
Look for Ubuntu installation at http://wiki.nginx.org/Install.
Look for ubuntu/ centos installation at https://nodevine.com/library/installing-multiple-virtual-hosts-on-nginx-on-ubuntu-12-04-and-cent-os-6
We can now add the repository to install the latest version of nginx:
sudo add-apt-repository ppa:nginx/stable
Note: If this command still does not work (normally on 12.10), run the following command:
sudo apt-get install software-properties-common
This will add the repository to Ubuntu and fetches the repository's key. This is to verify that the packages have not been interfered with since they have been built.
Step Three - Updating the Repositories
After adding a new repository, you will need to update the list:
sudo apt-get update
Install nginx
To install nginx or update the version you already have installed, run the following command:
sudo apt-get install nginx
Check That Nginx is Running
You can check to see that nginx is running by either going to your VPS' IP address/domain, or typing in:
service nginx status
This will tell you whether nginx is currently running.
with a vps debian wheezy
I have to install a lot of tools in order to install nginx 1.2.9 :
apt-get install libpcre3 libpcre3-dev
apt-get install --reinstall zlibc zlib1g zlib1g-dev
apt-get install make
apt-get install sudo

Resources