I am currently using Red Hat linux. I just want to find out whether MySQL is installed in that system. If yes where is it located? can anyone help please...
Type mysql --version to see if it is installed.
To find location use find -name mysql.
If you're looking for the RPM.
rpm -qa | grep MySQL
Most of it's data is stored in /var/lib/mysql so that's another good place to look.
If it is installed
which mysql
will give you the location of the binary.
You could also do an
updatedb
and a
locate mysql
to find any mysql files.
yum list installed | grep mysql
Then if it's not installed you can do (as root)
yum install mysql -y
to ckeck the status use the below command, which worked on debian....
/etc/init.d/mysql status
to start my sql server use the below command
/etc/init.d/mysql start
to stop the server use the below command
/etc/init.d/mysql stop
Usually you can find a program under a subdirectory "../bin".
System programs are under /usr/bin or /bin. To check where files of mysql package are placed, on RHEL 6 type like this :
rpm -ql mysql (which is the main part of the package)
and the result is a list of "exe" files such as "mysqladmin" tool. About to know the version of the server, run the command:
mysqladmin -u "valid-user" version
rpmquery <package Name> By this command you can check which package is installed.
For Example: rpmquery mysql
Related
I am looking for a way to identify on how to get a list all installed application including those applications on Linux which is not installed by any RPM package or YUM package.
I have installed Oracle Database using .sh and [My company application agent] one more application when I try to search for those application using
rpm -qa | grep 'application name' or using rpm -qa | sort |less
Or
yum list installed
Those applications were missing from the list. I am not sure why this is missing.
Could you please help me to find out this.
This is for Linux server.
rpm -qa
yum list installed
I am expecting the output of all installed application including those which are installed from .sh and .pkg or any third party application.
I have a linux server (completely new, web hosting, nothing is installed into it), and want to use a "wget" command. Currently, it is not found. Kernel version 2.6.32-896.16.1.lve1.4.54.el6.x86_64
I am completely new to linux, tried to solve this issue by myself, but couldn't do it. I log in into this linux server via PuTTY via my Windows OS laptop.
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
To get "wget" to work, I will need to install it. I guess I will need to install first "sudo" and/or "apt" and/or "apt-get". But couldn't do it. Please give me a short list of steps in which order to install them.
Given your kernel version, it looks like your Linux distribution is CentOS 6 or RHEL 6. Try installing wget with this command:
yum install wget
You must be root when you run this command.
Incase you using Debian version of Linux, use the following:
sudo apt-get install wget
From kernel version, it looks like you are using RHEL/Centos 6.
Please check -
https://centos.pkgs.org/6/centos-x86_64/wget-1.12-10.el6.x86_64.rpm.html
If the mentioned dependencies exist in your system, you can directly fire the rpm command
rpm command guide -
https://docs.fedoraproject.org/ro/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch02s03.html
If it doesn't work, you need to use yum command. (You need to configure yum command first, if not configured already)
yum install wget
To configure yum command in centos6 -
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-configuring_yum_and_yum_repositories
Note - you need to be root user for above activities.
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
I was following the instruction on the official website:
http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/SingleCluster.html
there are two problems I can't solve:
1. I can't run these commands:
$ sudo apt-get install ssh
$ sudo apt-get install rsync
picture_apt-get_commandnotfound
the website says: Unpack the downloaded Hadoop distribution. In the distribution, edit the file etc/hadoop/hadoop-env.sh to define some parameters as follows
I can't find this file: etc/hadoop/hadoop-env.sh
I have downloaded these files and uncompressed them:
hadoop-2.7.1.tar.gz
hadoop-2.7.1-src.tar.gz
hadoop-2.7.1.tar.gz.mds
hadoop-2.7.1-src.tar.gz.mds
thank you!
You will have ssh already. No need to install ssh again.
You can follow these instructions to set up Hadoop on VM. The instructions are mainly for Centos (redhat flavor). It works for Redhat, CentOS and Fedora.
How did you uncompress the files. You should use tar xzf hadoop-2.7.1.tar.gz. It will create directory with name hadoop-2.7.1. Then you need to cd to it and then you will find etc directory.
If you have hadoop-2.7.1.tar.gz in /home/. Then you need to go to /home//hadoop-2.7.1/etc/hadoop. Also you can find the location of hadoop directory by using find / -name "hadoop" -type d command. It will search your VM and report all the directories with name hadoop.
I have a write-up for installing single-node using VirtualBox and CentOS 6.5 here: https://github.com/trisberg/hadoop-install/blob/master/InstallingHadoop.adoc
Hopefully this provides some help.
I have installed PostgreSQL and it is working ok. However, when I went to restore a backup I got the error -bash: psql: command not found:
[root#server1 ~]# su postgres
[postgres#server1 root]$ psql -f all.sql
bash: psql: command not found
[postgres#server1 root]$
What have I done wrong?
export PATH=/usr/pgsql-9.2/bin:$PATH
The program executable psql is in the directory /usr/pgsql-9.2/bin, and that directory is not included in the path by default, so we have to tell our shell (terminal) program where to find psql. When most packages are installed, they are added to an existing path, such as /usr/local/bin, but not this program.
So we have to add the program's path to the shell PATH variable if we do not want to have to type the complete path to the program every time we execute it.
This line should typically be added to theshell startup script, which for the bash shell will be in the file ~/.bashrc.
perhaps psql isn't in the PATH of the postgres user. Use the locate command to find where psql is and ensure that it's path is in the PATH for the postgres user.
The question is for linux but I had the same issue with git bash on my Windows machine.
My pqsql is installed here:
C:\Program Files\PostgreSQL\10\bin\psql.exe
You can add the location of psql.exe to your Path environment variable as
described in this other answer, and shown in the screenshot below:
After changing the above, please close all cmd and/or bash windows, and re-open them (as mentioned in the comments #Ayush Shankar). If you are using an IDE like Visual Studio Code, please close and re-open the entire IDE (as mentioned in the comments #Somraj Chowdhury)
You might need to change default logging user using below command.
psql -U postgres
Here postgres is the username. Without -U, it will pick the windows loggedin user.
It can be due to psql not being in PATH
$ locate psql
/usr/lib/postgresql/9.6/bin/psql
Then create a link in /usr/bin
ln -s /usr/lib/postgresql/9.6/bin/psql /usr/bin/psql
Then try to execute psql it should work.
In case you are running it on Fedora or CentOS, this is what worked for me (PostgreSQL 9.6):
In terminal:
$ sudo visudo -f /etc/sudoers
modify the following text from:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
to
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.6/bin
exit, then:
$ printenv PATH
$ sudo su postgres
$ psql
To exit postgreSQL terminal, you need to digit:
$ \q
Source: https://serverfault.com/questions/541847/why-doesnt-sudo-know-where-psql-is#comment623883_541880
If you are using the Postgres Mac app (by Heroku) and Bundler, you can add the pg_config directly inside the app, to your bundle.
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
...then run bundle again.
Note: check the version first using the following.
ls /Applications/Postgres.app/Contents/Versions/
Check if PostgreSQL is installed or not.
If not you can do the same in ubuntu using this command.
sudo apt update
sudo apt install postgresql postgresql-contrib
there must be two reasons for this either the package is not install or psql is not defined in the PATH
the simple way is to create a link within the /usr/bin or /usr/local/sbin/
First find the the file
sudo find / -name psql
then create soft link
sudo ln -sf /opt/pgpro/1c-14/bin/psql /usr/local/sbin/psql
Sometimes we face this issue when the gem installation command doesn't find the pg client library for various reasons, such as if psql is not in the path.
In those cases, providing the command with the path to pg_config may fix the issue.
gem install pg -v 1.3.5 -- --with-pg-config=/path/to/pg_config
In my case, I faced a similar issue when I installed postgresql#12 with Homebrew in the Rosetta environment.
Following command solved the issue in my case.
gem install pg -v 1.3.5 -- --with-pg-config=/usr/local/Homebrew/Cellar/postgresql#12/12.13/bin/pg_config