No permission when setting up ruby on rails

2019-08-09 02:08发布

问题:

Today I was trying to set up ruby on rails with postgresql using this tutorial:

https://gorails.com/setup/ubuntu/14.04

Here are my commands till the first encountered problem:

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

Then the terminal told me that rbenv is not installed and I should install it. The tutorial didn't say something like that, so I looked back at my commands and I saw I had a typo in the first echo command.

So I typed the 3 last commands again:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

The terminal said the same thing, so I ignored it and continued.

Everything seemed ok till the end when I ran rails server for the first time. The terminal told me that some gems are missing and I should install them. I did that. When I tried to run the command again, this message came up:

http://pastebin.com/etEjufzd (I'm posting it through pastebin because it's a large message)

I thought that I should change the permissions of the development log, but is this really the problem? At the comment section of the tutorial it didn't seem like this happened to other people. If this is indeed the cause of my server failing to start, how do I change the permissions of this file? It is indeed a read-only file.

Also, if the mistake was that typo in the beginning of the process (or in some other part of the process which I didn't notice), how do I do it again without collisions? In other words, is it possible to take back things that I've done so that I can do them again?

Thank you very much for your time.

回答1:

First, to remove this warning:

warning: Insecure world writable dir /home in PATH

You should do:

chmod go-w /home/

This will remove the write permission from group and other (everyone else except the file owner).

Secondly, to remove this error:

Rails Error: Unable to access log file. Please ensure that /home/pavlos55/myapp/log/development.log exists and is writable

Just do:

chmod 0664 /home/pavlos55/myapp/log/development.log


回答2:

Your git clone command is invalid:

git clone git://github.com/sstephenson/rbenv.git .rbenv

You need to use HTTPS protocol:

git clone https://github.com/sstephenson/rbenv.git .rbenv