Does make/gmake include all the libraries after built? - nginx

I was building the openresty Nginx on machine A and want to use it on machine B. Is it necessary to install all the rpm/dependencies on machine B?
The building process on machine A is like:
yum install multiple-devel commands
git clone multiple repositories
wget openresty.tar.gz
untar openresty, cd openresty and ./configure --...
gmake
gmake install
When I tried to understand the relationships between configure, make and make install, I found https://stackoverflow.com/a/54628708/11887927 but still not quite get it.
If it's still required to install all the rpm&dependencies, what's the benefit of building on my own or I'm totally wrong about the make process?

Maybe I didn't make myself clear enough. Thanks for anyone stopping by.
Machine B doesn't require rpm/dependencies but needs libraries built on machine A
Here is how it works:
copy Nginx binary/configurations to B
copy libraries(including folders, openresty in my case) to B
echo libraries to /etc/ld.so.conf.d, /etc/ld.so.conf.d/luajit.conf in my case

Related

Atom on Raspbian?

Very nooby question, but I'm trying to install Atom text editor on Raspbian Stretch. Is it possible? I've heard because it runs on Electron, it's quite slow for Raspbian. I keep getting an error saying:
E: Unable to locate package atom
I'm following the official instructions for Debian. How can I fix this?
As of today you can't install the official package provided for Debian for its mismatching the hardware platform. Provided binary is for running on x86 hardware, but RPi doesn't come with an Intel/AMD processor, but ARM. So, you most probably need to build it from source yourself.
Primer
So, if you really want to build this from source, you should be aware of the waste of disk space caused by the IMHO poorly implemented build tool which is downloading tons of deps and copying and transpiling code around so you'll end up with 2GB+ of files with 80% accounting to dependencies, only. Since my RPi works with 8GB smartcard, only, I couldn't ever meet the need for disk space even though I was bleeding out Linux by manually removing docs, manpages, locales, ton's of outdated and mostly unused apps etc. The build also requires a whole build tooling chain, tons of dev packages for libraries, so there is a limit to milk the system ... 8GB disk drive simply isn't enough for this.
Eventually I tried moving all the files to a USB pen drive. But that drive must be formatted using a filesystem capable of symlinking. So you can't use vfat or FAT32. I didn't succeed to get a 16GB stick formatted with either version of extfs. The mkfs always ended up in a deadlock on trying to write its superblocks. Astonishingly, I couldn't even kill the mkfs with -KILL, but unplugging the drive did help in that case.
So, as a conclusion: here is a short list of steps I passed in expectation to get this working, but in the end I didn't finish due to the memory issues above. And frankly, I stopped caring ... I'd rather work with nano/vi in a terminal than using this ridiculous lego-like built software. I guess, atom is today's version of emacs with regards to the latter's acronym. Maybe you succeed with this, but I won't ...
Build from Source
Inspired by https://discuss.atom.io/t/atom-on-the-raspberry-pi/33332
Install toolchain for building native stuff
sudo apt-get install build-essential git libgnome-keyring-dev fakeroot gconf2 gconf-service libgtk2.0-0 libudev1 libgcrypt20 python rpm libsecret-1-dev xorg-dev
This set of tools was sufficient to build core files without error. Since I didn't start with a fresh installation of Raspbian there might have been some tool I have been using before, so maybe in your case there are more tools to be installed here. Look out for error messages in early stage of building and try to see if some library or header file isn't found. This mostly indicates lack of some package with name ending in -dev to be installed, too. Start by searching for the package using apt search <name-of-mentioned-library> and look for a package combining the missing library's name with suffix -dev. Then install it the usual way by invoking sudo apt-get install <package-name>.
Install up-to-date nodejs
Raspbian Stretch comes with support for NodeJS 8.11 which is basically okay. Install it and its package manager npm using this command:
sudo apt-get install node-js npm
Check installed versions with
node -v
npm -v
This should display 8.x.x on behalf of NodeJs. Use n afterwards if you want to step up:
sudo npm i -g n
sudo n lts
This will switch NodeJS to latest LTS release, which is 10.x as of now. Upgrading NodeJS is optional, but feel advised to always use latest version of npm:
sudo npm i -g npm
Check if upgrades succeeded:
node -v
npm -v
Adjust configuration of npm and install some essential dep:
sudo npm config set -g python /usr/bin/python2
sudo npm i -g node-gyp
Build Atom
Get the source. One option is to pull latest code from its repository:
git clone https://github.com/atom/atom.git
This is creating subfolder atom containing all source files. You might want to download sources of a recent release instead. But this tutorial was made with the sources fetched from Github. So make sure there is subfolder called atom containing sources similar to the ones fetched above.
It's time to start the beast:
cd atom
./script/build
This process will take a while. And it is the culprit that never finished on success in my case due to eating up all disk space over and over again.
Whenever the script fails on error, try to analyze the error, find the cause, fix it, then start the script by repeating the last command above again. If you don't remove any file in subfolder atom in between, the build script keeps passing steps of building atom it has passed successfully before.
Install atom
According to the original tutorial linked before the script should finish on success eventually. Then it's time to install with:
./script/grunt install
I guess this is causing atom to be available as a command from CLI. So, try it out. If everything looks fine you are finally ready to remove the waste of files in subfolder atom.
Feel free to report if this was working in your case.
From what I recall Atom runs 64-bit architecture; need the latest raspberry Pi.
run the following
wget https://atom.io/download/deb && dpkg -i deb

Where to install "guile-git" on Ubuntu 14?

I got stuck installing "git clone https://gitlab.com/guile-git/guile-git.git". In which directory is this supposed to be cloned and installed?
Dunno if you're still looking for an answer but it doesn't seem you need this installed to install guix; the read-me of the repository says that you can install it via guix. guix is an agnostic package manager that you can install on any Linux distribution alongside the default package manager and guix is the default package manager of the GuixSD operating system (https://www.gnu.org/software/guix/).
If you're on a distro which doesn't use guix, you may not want to install guix (I've yet to find reason enough to, yet); if you use a lot of GNU tools or Guile (some Guile packages are available through guix), you may want to.
Most repositories that don't have a binary for you to run follow the build process of configure, make, and [sudo ]make install.
I cloned the repository, myself, and find that this one does, as well.
Get a terminal (if you haven't been using one, yet) and cd into the directory you cloned the repository to and then cd into the guile-git directory (cd guile-git).
If we do ls -l, we'll see that the only executable file there is the bootstrap one; I've never seen one before but doing ./bootstrap generates the configure file and sets up the make process for us. So now back in familiar territory.
Given these are Guile files, we'll probably want to install this under the same prefix as where Guile is installed so run which guile. I believe, if you install it under Ubuntu (I'm running Linux Mint), it'll install to /usr/bin/ but, if you install it manually, it'll install to /usr/local/bin/.
The latter is where mine is and that's the default prefix that configure uses so I can just do ./configure; if you wanted to install it under /usr/, run /.configure --prefix=/usr/.
This'll verify that all of the necessary libraries and programs that guile-git needs are installed and properly setup. Heads up that configure balked at me over not having the Guile module bytestructures installed (https://github.com/TaylanUB/scheme-bytestructures) so you may need to do that.
I'm not going to run through everything to get it installed but, once you can run it without any errors, run make to build it within the directory.
If you want to install it permanently on your computer with the rest of your operating system able to detect it, run make install. Since you'll likely've specified a directory under /usr, you'll have to do sudo make install so that the make process can have permissions to install under /usr/local or /usr.
Sorry if I reiterated anything you already knew; 'just didn't want to assume you knew something and result in confusion.

How to correctly install dokku - with or without sudo?

I'm learning dokku right now for simple web deployment. Offical install instructions state this command:
wget -qO- https://raw.github.com/progrium/dokku/v0.3.12/bootstrap.sh | sudo DOKKU_TAG=v0.3.12 bash
I'm not a devop or admin, but as far as I understand this line, it performs all bootstrapping and installation under the root account, thanks to sudo. So dokku will be checked out into a directory with root access rights, and all additional directories like /var/lib/dokku/ will also have root access rights.
The problem is - all articles across the internet about dokku instructs to execute dokku command or do dokku-related actions without sudo. For example, instructions about this dokku database plugin, https://github.com/krisrang/dokku-mariadb, instructs to install it via:
cd /var/lib/dokku/plugins
git clone https://github.com/krisrang/dokku-mariadb mariadb
dokku plugins-install
This is not working, since /var/lib/dokku/plugins have root access rights and git clone will fail with acces denied. It's hard to be a non-admin nowadays, but maybe someone will hint what I'm doing wrong? Do I need to install dokku some other way, or all dokku-related tutorials across internet assume that I'm executing them under root (which is, by my limited admin knowledge, highly not recommended for security reasons).
You should run those three commands as sudo:
sudo su -
The dokku binary will run code as the dokku user even if you execute as root. So it should be fine to run that as is. Once you are the sudo user, just run the install instructions listed in your question. Hope my answer helps ! :)
I also contacted them as they mentioned:
In the future, we'll have a method to install plugins directly with a
dokku command
As far as I can tell, you need to run it as root. A traditional way to install a program without root-privileges is to download the source and compile it, which can be done by running:
git clone https://github.com/progrium/dokku.git
make
make install
Dokku's makefile depends on apt-get, which requires root access to run.
I'm not familiar with dokku or dokku-mariadb, but I think the author of dokku-mariadb also assumes root access.
For people running into the question on wether its fine to install through root user (on fresh created VMs as per the guide), try checking this Github issue:
https://github.com/dokku/dokku/issues/961
Since the commands related to dokku are prefixed with # rather than $, it means that its not necessary to run them from non-root user. It also makes writing suddo unnecessary (and form my experience counterproductive).

Installing Nginx-auth-ldap on Debian

I tried to install Nginx-auth-ldap on my Debian server, but I can't understand how to do it right. I have been looking on https://github.com/kvspb/nginx-auth-ldap/wiki/How-to-install and tried the commands for Linux.
The thing I can't understand is
./configure --add-module=path_to_http_auth_ldap_module
make install
I don't have a folder called configure in the Nginx folder.
Please help me to understand how I will make that work.
The key is one sentence from the linked page that you skipped. The whole instructions say:
cd ~ && git clone https://github.com/kvspb/nginx-auth-ldap.git
in nginx source folder
./configure --add-module=path_to_http_auth_ldap_module
make install
"In nginx source folder" refers to a directory where you would have the source code of nginx. This means you are supposed to re-build nginx with the new module.
What you should do
Download the nginx sources 1
Download the nginx-auth-ldap module
Compile nginx with the module
However, I did not test this, so it is possible that you need additional libraries or sources like the ones for ldap...
Don't install nginx through Debian's package manager. Instead, as jasperado suggested, you'll want to download nginx from source.
You can download the mainline version thus:
wget http://nginx.org/download/nginx-1.9.2.tar.gz && tar xzf nginx-1.9.2.tar.gz
Before you build, you may want to make sure PCRE3 is installed on your system because ngx_http_rewrite_module requires it, and the installer will try to load this module.
When ready, you go into the nginx source directory and then you can do the whole configure and make thing. You might find this article helpful.
For example,
./configure --prefix=/usr/local --with-http_stub_status_module --add-module=$HOME/nginx-auth-ldap
make
sudo make install

Recompile Nginx with additional modules

I installed Nginx via apt-get on Debian a while ago, and I've got a couple of sites live on it. Now I need to install some additional modules, and as I don't want to mess anything up I'd like to double check my process before I perform it. Hopefully this will also help others that are unsure about this part.
As I've understood it I have to do the following to minimize the downtime:
Download the source for Nginx
Add the additional modules with ./configure --additional-module
Compile Nginx with make
Stop the current server (service nginx stop)
Install Nginx with make install
Start the new server (service nginx start)
Or do I have to uninstall Nginx first, as it's not compiled from source at this point?
Having done something similar on Ubuntu before, the installation should overwrite the existing nginx binaries with the newly compiled ones, so long as yes, you ensure nginx isn't running on the system at the time.
I'd recommend trying to install nginx elsewhere on the system, so in case you can't get it to work quickly, you can restart your web server with the old nginx binaries and not have significant downtime.
nginx -V - helpful command which shows options for .\configure which was used to make nginx, which is actually working.
Helpful to get detail imagination about.
apt-get source nginx - to get source
install will automatically substitute actual installed version by new one
Keep also in mind that some nginx-modules can require additional libs on server. geoip module is classical example of it

Resources