Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Monday, 9 July 2018

Complete Postgres installation step by step

Homebrew is a popular package manager for OS X. To install Postgres with Homebrew, follow the steps below: The first thing to do is install Homebrew if you haven’t done so already. Homebrew site has a simple command that you have to paste in your terminal to do so. Make sure to accept the command line developer tools installation if prompted. Next, run brew install postgres to install Postgres. It might take a little while to compile and install. After compilation is done, it’ll give you some instructions to finish setting it up. The database will be initialized during installation, so there isn’t a need to run initdb to finish installation of Postgres via Homebrew. Near the end of the installation instructions you should see mention of the command brew services. If you don’t already have brew services installed. It may be installed with this command: brew services stop/start postgresql createuser -s postgres

Remove previous versions of PostgreSQL

brew uninstall --force postgresql
Delete all Files of Postgres

rm -rf /usr/local/var/postgres
Install Postgres using Homebrew

brew install postgres
Start Postgres

pg_ctl -D /usr/local/var/postgres start

or

brew services stop/start postgresql

download pgAdmin https://www.postgresql.org/ftp/pgadmin/pgadmin4/v2.0/macos/
Share:

Tuesday, 31 May 2016

Monday, 30 May 2016

Save A File Opened in VI As The Wrong User

This happens to me all the time. I login as a normal user and start editing a file using vim. After editing is done, when I try to save the file, I don't have enough permission to save the file. I have to close the file, login as root and start editing again. Below is the given error in vim:

Try the below command
:w !sudo tee %
Explanation
  • :w – write
  • !sudo – call shell sudo command
  • tee – the output of write (:w) command is redirected using tee
  • % – current file name


stackoverflow.com/questions/28635647/how-can-i-save-a-file-i-opened-in-vim-as-the-wrong-user
Share:

Unix Command To Run .sh File


chmod Command: Run Shell Script In Linux

Another recommend option is to set an executable permission using the chmod command as follows:
chmod +x file.sh
Now your can run your .sh file as follows
./file.sh


cyberciti.biz/faq/run-execute-sh-shell-script/
Share:

Unix Deleting Folder and Files

Deleting folder and files under it. Go to the folder you want to delete then issue this command.

 sudo rm -r deletingdir 

 sudo - changing the access as root owner or admin.
 deletingdir must be in the list when you issues this ls
Share:

Popular Posts

Recent Posts

Pages

Powered by Blogger.

About Me

My photo
For the past 10 years, I've been playing with codes using PHP, Java, Rails. I do this for a living and love new things to learn and the challenges that comes with it. Besides programming I love spending time with friends and family and can often be found together catching the latest movie or planning a trip to someplace I've never been before.