I have shared hosting at Hot Drupal with SSH access. I have a couple of sites in subdirectories of my HTML root.
This is what worked for me.
I could not install Drush to /usr/bin/lib so I put it in my home directory ~/drush/drush
Then with PuTTY I navigated to the subdirectory where I want to use Drush. I created an alias with alias drush="~/whereyouputdrush/drush"
where the ~/ is my home directory.
then I was able to use right there eg myusername@mydomain.com [~/public_html/meier]# drush help
(this is repeated from http://drupal.org/node/513896#comment-2346908 b/c I think this method should be added to the documentation, which currently says $ alias drush='/path/to/drush/drush'
but not how to set path to your home dir with ~/)
Comment | File | Size | Author |
---|---|---|---|
#13 | drush-652840.patch | 1.76 KB | greg.1.anderson |
#8 | drush-652840.patch | 853 bytes | greg.1.anderson |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedthanks ... You could help even more by preparing text exactly as you propose it appears in readme.
Comment #2
decibel.places CreditAttribution: decibel.places commentedproposed additions to README.TXT:
For Linux/Unix/Mac:
1. Untar the tarball into a folder outside of your web site (/path/to/drush)
- on shared hosting with SSH you can place Drush in your home directory ~/drush since you will not have access to usr/bin/
2. Make the 'drush' command executable:
$ chmod u+x /path/to/drush/drush
3. (Optional, but recommended:) To ease the use of drush,
- create a link to drush in a directory that is in your $PATH, e.g.:
$ ln -s /path/to/drush/drush /usr/bin/drush
OR
- create an alias to drush:
$ alias drush='/path/to/drush/drush'
(this goes into .profile or .bash_aliases in your home folder)
- on shared hosting with SSH you can also create an alias with bash from the command line
navigate to the directory where you want to use drush (could be root public_html or a subdirectory)
create alias with '# alias drush="~/drush/drush"'
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedThanks.
Your last bullet may not be a good idea. The alias disappears after user terminates ssh session. The files .profile and .bashrc are needed in order to persist aliases across sessions.
Comment #4
decibel.places CreditAttribution: decibel.places commentedthanks for that info about persistence - shows why a little knowledge is dangerous at the command line~!
adding
alias drush="/drush/drush"
oralias drush="~/drush/drush"
to .bashrc creates an alias in the ~/ home directory, how do I put the aliases in subdirectories eg public_html/faith ?I get No such file or directory error:
Comment #5
greg.1.anderson CreditAttribution: greg.1.anderson commentedNot familiar with jailshell, but try using a full path rather than ~/drush/drush. (From the error message, it looks like you used
alias drush="drush/drush"
, but that might be an artefact of how the jail works.)Comment #6
decibel.places CreditAttribution: decibel.places commentedI forgot you need to exit and start a new session [retarded at the command line]
putting
alias drush="~/drush/drush"
in .bashrcTHEN EXITING AND RESTARTING is now working in subdirectories
***********************************************************
so I would revise my proposed addition:
(note: I think the prompts $ and # are confusing, look like part of the code - guess it's part of the normal syntax/style)
OR
- create an alias to drush:
$ alias drush='/path/to/drush/drush'
(this goes into .profile or .bash_aliases in your home folder)
- on shared hosting add a permanent alias with
alias drush='~/drush/drush' in .bashrc and/or .profile and/or .bash_aliases
where ~/ is your home/username directory and drush/drush is where you have installed drush relative to that directory
* You may need to exit your SSH session and log in again for the changes to take place!!!!!!!!!!!
- you can also create a temporary alias just for the session: navigate to the directory where you want to use drush
create the temporary alias with $ alias drush="~/drush/drush"
Comment #7
decibel.places CreditAttribution: decibel.places commentedchanging title to reflect emphasis on shared hosting and de-emphasis on temporary alias from command line
Comment #8
greg.1.anderson CreditAttribution: greg.1.anderson commentedI'm working on a change README.txt that depends on #654680: Simplify canonical site aliases, so I just went ahead and rolled a patch for you so that we can get this committed and not make conflicting patches.
The only change that I think is really necessary to the existing readme is to (a) add .bashrc to the list of config locations, and (b) add a warning that changes to bash settings files do not take effect until you exit and restart. (You can usually execute
source .bashrc
to apply the settings.) I don't know how many different bash config files we need to list (should we add .bash_customizations and /etc/bash.bashrc), but here's my stab at a minimal change. I assert that the note about ~ being your home directory is not notworthy, as most users should know that they can convert '/path/to/drush/drush' to '~/drush/drush' if the later works better for them.Hopefully this will make things clearer and help some people without being too verbose.
Comment #9
decibel.places CreditAttribution: decibel.places commentedAs a Drush novice, I found the ~ confusing when following the DrupalCampNYC seminar. It did not look like the path given '/path/to/drush/drush'
Although many shared hosts do not allow shell access at all, I think some specifics about placing Drush in an atypical position below the usr/bin path AND how to alias it would be helpful.
I know that it would have saved me a couple of hours of trial and error.
And for the truly novice SSHer, a reminder to exit and restart to use the new settings would also be helpful! (but thanks for the
source .bashrc
tip)Maybe this thread will be helpful to those struggling with these issues.
Comment #10
greg.1.anderson CreditAttribution: greg.1.anderson commentedI am torn between my genuine desire to help novices, and my personal opinions about how much information is too much in a readme file. Overall, I think that if you're at the point where you don't understand ~, then it would be better to look to outside information on the shell rather than expecting enlightenment from the drush readme file, as there are other important and useful concepts you would likely discover in the process. Therefore, were I to add more to what I already put in the message in my suggested patch above, I think it would be "man bash" or "google 'bash tutorial'". The first hit I got for the later was Getting Started with BASH, A Bash Tutorial" on hypexr.org. Reading this page would take less than two hours--reading all of "man bash" would take less than two hours. You might not understand it all as a novice, but it sure would be helpful.
No disrespect intended; the bottom line is, I stand by my initial recommendation from #8 above.
Comment #11
decibel.places CreditAttribution: decibel.places commentedgreg, I understand and basically agree - that is why I closed with "Maybe this thread will be helpful to those struggling with these issues."
very often I struggle with and solve a problem on a d.o. thread - and then later on a few people find the info useful enough to post thank yous
from the POV that someone looking to use Drush may know a thing or two about SSH - that is a point well-taken
as a former teacher, I also realize that the student may not grasp the content well enough to formulate a meaningful question (or Google search)
I am not lobbying for inclusion of every detail in README.TXT - but enough to provide info for addional learning, perhaps the hypexr.org manual you suggested.
my OP was a result of "discovering" a technique for a (turned out to be temporary) alias that was not specified in README or the DrupalCamp session - this thread has drifted a bit but it should be helpful for Drush noobs on shared hosting...
Comment #12
greg.1.anderson CreditAttribution: greg.1.anderson commented@moshe: I'm going to take one more pass on my patch to make it a little clearer for novices.
Comment #13
greg.1.anderson CreditAttribution: greg.1.anderson commented@decibel.places: Thank you for your patience. When you've been using bash for a while, it's sometimes easy to loose perspective about what "everybody should be expected to know", and you're right, the point of your OP was that quite a few people don't realise that ~ is your home directory.
Here is one more attempt at adding hints and pointers to help people get started without being too verbose about it. Let me know if you think it's clear enough.
Comment #14
decibel.places CreditAttribution: decibel.places commentedgreg,
thanks for your consideration
I think it is pretty clear.
I'm not sure that it's clear where you can install drush for someone trying to install drush in usr/lib but without permissions (as was my case - I could look but not touch)
where the "home" directory is (in my case ~/ points to home/myusername/ so it's actually a subdirectory of "home")
I wouldn't fret too much, I was able to figure it out so let's hope others will with a bit more info than I started with.
Comment #15
greg.1.anderson CreditAttribution: greg.1.anderson commented@decibel.places: /home/myusername is, in Unix parlance, known as your "home directory", despite the fact that its parent directory is usually called "home" and is not, in fact, anyone's home directory. Most of the time users without root access will not be able to write to /usr/lib or /usr/local, but I think it is beyond the scope of the drush readme to go into that.
@moshe: I leave it up to you to take either #8 or #13 per your preference. I'll also roll it again if you'd like to see any changes.
Comment #16
greg.1.anderson CreditAttribution: greg.1.anderson commentedCommitted a slight variant of #13 to help out beginners. Just let me know if you'd like any further adjustments or additions.