I am new to postgres and was following this tutorial for setting Up Physical Streaming Replication with PostgreSQL
In step 3 while running the following command:
sudo -u postgres rm -r /var/lib/postgresql/12/main/*
I was getting the following error
rm: cannot remove '/var/lib/postgresql/12/main/*': No such file or directory
while the /var/lib/postgresql/12/main/ clearly had many files if explored manually.
In desperation, I deleted all the files inside /var/lib/postgresql/12/main/ manually and now any of the further steps are not working.
I have even tried to uninstall and install postgresql-12 using
sudo apt-get --purge remove postgresql
and
sudo apt -y install postgresql-12 postgresql-client-1 respectively
I have even tried doing the whole process again from start and while running the following command:
sudo -u postgres psql
sudo pg_ctlcluster 12 main start
I got this error:
Job for postgresql#12-main.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status postgresql#12-main.service" and "journalctl -xe" for details.
while resolving the above issue using :
sudo chown postgres.postgres /var/lib/postgresql/12/main/global/pg_internal.init
I got this error...
chown: cannot access '/var/lib/postgresql/12/main/global/pg_internal.init': No such file or directory
I think this is happening because of the manual deletion of all the files and folder in
/var/lib/postgresql/12/main/
Any help is much appreciated
Thanks
The glob * is evaluated by your regular user before the sudo is invoked, but your regular user can't see into that directory. So what gets sent to the postgres user is an order to remove the file with the literal name of '/var/lib/postgresql/12/main/*', which doesn't exist. You would need to have your shell that evaluated the glob be postgres, so it can see what it is doing before invoking rm. Something like:
sudo -u postgres bash -c 'rm -r /var/lib/postgresql/12/main/*'
For the rest of it, you didn't give enough details to know what is going on, like what was in the logs, or what were the directory listings at the time your command failed.
Nowadays robomongo developers releasing the new versions of robomongo as tar.gz not in .deb packages that was easy for double click installations. But that option is no longer available. So how to install it as a program in Ubuntu. I have tried extracting the package and install but failed.
admin#admin-lenovo:~$ cd Downloads/
admin#admin-lenovo:~/Downloads$ tar -xzf robomongo-0.9.0-rc4-linux-x86_64-8c830b6.tar.gz
admin#admin-lenovo:~/Downloads$ cd robomongo-0.9.0-rc4-linux-x86_64-8c830b6/
admin#admin-lenovo:~/Downloads/robomongo-0.9.0-rc4-linux-x86_64-8c830b6$ ./configure
bash: ./configure: No such file or directory
Also .make and ./install failed as no files found. How to install it as a program?
Robomongo is now Robo 3T. Following are the updated steps:
Download the tar file from robomongo site. The current file is robo3t-1.1.1-linux-x86_64-c93c6b0.tar.gz, but yours could be different.
Open up the terminal, switch to download directory and run the following commands:
$ tar -xvzf robo3t-1.1.1-linux-x86_64-c93c6b0.tar.gz
$ sudo mkdir /usr/local/bin/robomongo
$ sudo mv robo3t-1.1.1-linux-x86_64-c93c6b0/* /usr/local/bin/robomongo
$ cd /usr/local/bin/robomongo/bin
$ sudo chmod +x robo3t
$ sudo gedit ~/.bashrc
Add the following line to the end of .bashrc file:
alias robomongo='/usr/local/bin/robomongo/bin/robo3t'
Save and close the file. Now reload it using the following command:
$ source ~/.bashrc
Then you can run robomongo from your terminal and it will work:
$ robomongo
You can also put the robomongo into /usr/bin like I do:
tar xf robomongo-0.9.0-rc8-linux-x86_64-c113244.tar.gz
sudo mv robomongo-0.9.0-rc8-linux-x86_64-c113244/ /usr/bin/robomongo
export PATH=/usr/bin/robomongo/bin:$PATH
If you are using fish shell, you need to change the last line to:
set PATH $PATH /usr/bin/robomongo/bin
Now you can start it with command:
robomongo
Pulled this from my dotfiles. It's ugly but it works... and it's a bit more verbose so it should be understandable to most:
# Pull down and install Robomongo by copying files
cd /tmp
wget https://download.robomongo.org/0.9.0/linux/robomongo-0.9.0-linux-x86_64-0786489.tar.gz
tar xf robomongo-0.9.0-linux-x86_64-0786489.tar.gz
sudo mv ./robomongo-0.9.0-linux-x86_64-0786489 /opt/robomongo
cd /usr/sbin
sudo ln -s /opt/robomongo/bin/robomongo
# Grab image to use for icon
cd /opt/robomongo
wget http://mongodb-tools.com/img/robomongo.png
# Create desktop entry
touch /tmp/robomongo.txt
echo "[Desktop Entry]" >> /tmp/robomongo.txt
echo "Encoding=UTF-8" >> /tmp/robomongo.txt
echo "Name=Robomongo" >> /tmp/robomongo.txt
echo "Comment=Launch Robomongo" >> /tmp/robomongo.txt
echo "Icon=/opt/robomongo/robomongo.png" >> /tmp/robomongo.txt
echo "Exec=/usr/sbin/robomono" >> /tmp/robomongo.txt
echo "Terminal=false" >> /tmp/robomongo.txt
echo "Type=Application" >> /tmp/robomongo.txt
echo "Categories=Developer;" >> /tmp/robomongo.txt
echo "StartupNotify=true" >> /tmp/robomongo.txt
mv /tmp/robomongo.txt ~/.local/share/applications/robomongo.desktop
1. First Download the version from the official Robomongo website bellow:
Download Robomongo From Official website using this link
2.Then extract the downloaded tar.gz file in your downloads folder.
3. Copy and paste the extracted folder into your opt folder
/opt
NB: If you don't have permission to paste in this folder use the bellow command in terminal to access the folder.
$ sudo chmod -R 777 /opt
4. Open the opt/robomongo/bin folder and launch Robomongo by clicking the executable icon.
opt/robomongo/bin
5. Simply Create a database and right click on the Robomongo icon and select the lock to launcher option. This will create a shortcut t launch the Robomongo application at any time you need.
You can first extract the package:
cd ~/Downloads
tar -xzf robo3t-x.x.x-linux-x86_64-xxxxxxx.tar.gz
You can rename the folder to something simpler
mv robo3t-x.x.x-linux-x86_64-xxxxxxx robo3t
Dowload any images with format .png [click here][1]
(For whatever reason, the Robo3T package itself does not contain any png file for the icon)
Save the image like robo3t.png and move this image to folder robo3t and then, instead of dumping the whole thing in /usr you can transfer this directory to /opt directory and symlink the binary file to /usr/bin or /usr/local/bin. This makes for a better way of organising your applications, and keeping such add-on packages is what /opt is for.
So first move the directory
sudo mv robo3t /opt
and then symlink it like so
sudo ln -s /opt/robo3t/bin/robo3t /usr/bin/robo3t
then you can create an Unity desktop file for your launcher
nano ~/.local/share/applications/robo3t.desktop
and finally; paste the next code in the file newly created
[Desktop Entry]
Encoding=UTF-8
Name=Robo 3T
Exec=robo3t
Icon=/opt/robo3t/robo3t.png
Terminal=false
Type=Application
Categories=Development;
And Happy coding!
Currently there is no installer for robomongo-0.9.0-rc4. you can create a desktop shortcut to robomongo-0.9.0-rc4-linux-x86_64-8c830b6/bin/robomongo file and use it just like any other Ubuntu app. Take a look at this tutorial https://askubuntu.com/a/142197/71544
Wathc this Video
How to install robomongo on ubuntu 16.4
OR
Follow Below Steps
Open Terminal and run the below command
wget https://download.robomongo.org/0.9.0/linux/robomongo-0.9.0-linux-x86_64-0786489.tar.gz
Extract the tar.gz file to enter below command
tar -xvzf robomongo-0.9.0-linux-x86_64-0786489.tar.gz
create a dir /usr/local/bin dir name directory name robomongo and move it to extract file into robomongo directory
sudo mkdir /usr/local/bin/robomongo
sudo mv robomongo-0.9.0-linux-x86_64-0786489/* /usr/local/bin/robomongo
run command only if robomongo isn't executable file
cd /usr/local/bin/robomongo/bin
sudo chmod +x robomongo
./robomongo
Don't worry about how to install Robo-3T on your Linux machine, follow these simple steps:
Download script from Robo3T-Installation-With-Desktop Entry
Open terminal in directory where above file is downloaded and run below command
sudo chmod +x ./Robo3T-Installation-Menu.sh
Then type below command and hit enter
./Robo3T-Installation-Menu.sh
Just wait to complete it, once completed enjoy RoboMongo. Search in menu with name "Robo 3T".
Well, I do not know if it might still help, but one efficient way to install Robomongo from tar.gz file is the following:
Go to https://robomongo.org/download to grab the tar.gz file,
After download,
cd Downloads/*
and then type in the terminal:
$ sudo tar xzf robo3t-1.3.1-linux-x86_64-7419c406.tar.gz -C /opt/
Make sure your file has been unzipped in the /opt directory by checking:
$ ls -lh /opt/
Next, install it by doing:
$ sudo /opt/robo3t-1.3.1-linux-x86_64-7419c406/bin/robo3t
The installation wizard pops up and accept the terms and continue installation. Then Enjoy
NB: You will not see the robot3t icon in the start menu. So to start robot3t, always
/opt/robo3t-1.3.1-linux-x86_64-7419c406/bin/robo3t to launch robo3T.
Hope it helps ;)
I have installed postgres9.4 on Ubuntu
I used to be able to run psql just fine.
symbol lookup error: /usr/lib/postgressql/9.4/bin/psql: undefined symbol: PQhostaddr
As per Craig's comment I did a little digging.
I confirmed using ldd that PQhostaddr is the only exception.
I also tried this:
$ sudo ldconfig -v | grep libpq
/sbin/ldconfig.real: Path /lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path/usr/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: /lib/x86_64-linux-gnu/ld-2.19.so is the dynamic linker, ignoring
libpq.so.5 -> libpq.so.5.7
I can however only see the directories in each place once. (not repeated)
I also can't find libpq
So generally not doing amazingly with this. I would have assumed there was a method of updating libpq.so.5.7
Am I barking up the wrong tree? (Or just barking mad)
I had the same issue but I was able to resolve it by completely removing postgresql with these commands.
apt-get --purge remove postgresql\*
rm -r /etc/postgresql/
rm -r /etc/postgresql-common/
rm -r /var/lib/postgresql/
userdel -r postgres
groupdel postgres
Then reinstalling postgresql.
Worked for me: removed completely and reinstalled PostgreSQL packages (but the cluster)
Steps to recreate error:
brew uninstall postgresql
brew prune
brew install postgresql
run postgresql start commands
psql
yields:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Suggested fixes I have tried that don't work:
create missing symbolic link:
sudo mkdir /var/pgsql_socket/
sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/
remove postmaster.pid file (same link as above):
rm /usr/local/var/postgres/postmaster.pid
create potentially "cleaned up" directories from upgrade:
mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/
touch /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/.keep
Related GitHub issue
Edit 1:
This article correctly speculates that there are multiple versions of postgres in use, and which pg_ctl must be specified (below). Strangely, there are two directories in /usr/local/var: postgre & postgres. If anybody knows which settings to update to use the proper pg_ctl command directly, I would appreciate it!
/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_ctl -D /usr/local/var/postgre start
I ran into the same issue and after looking at the log file I found one directory was missing:
$ tail /usr/local/var/postgres/server.log
FATAL: could not open directory "pg_tblspc": No such file or directory
Then I did $ mkdir /usr/local/var/postgres/pg_tblspc, restarted PostgreSQL and got:
$ tail /usr/local/var/postgres/server.log
FATAL: could not open directory "pg_replslot": No such file or directory
After redoing the process may times I eneded up creating the following directories and then successfully started PostgreSQL:
/usr/local/var/postgres/pg_tblspc
/usr/local/var/postgres/pg_replslot
/usr/local/var/postgres/pg_twophase
/usr/local/var/postgres/pg_logical
/usr/local/var/postgres/pg_logical/mappings
I hope this helps.
I just updated to Mavericks and trying to get all my required tools and software in place.
My mongodb is not working after installing mongodb through brew.
I did: brew install mongodb --devel
Then, I ran mongod& on terminal. This gives me:
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
I tried creating a directory: mkdir -p /data/db and I got permission denied as the error.
I am referring to this website "http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/" and installing Mongo using Homebrew.
Has anyone faced this issue before? Where do I actually find /data/db directory to give permissions to it? I tried ls -la in my home folder, but couldn't find this directory.
Please ignore. Here is what helped me to solve the problem:
$ sudo mkdir -p /data/db/
$ sudo chown `id -u` /data/db