Install newer python version

Depending upon your server OS, you may find the Python version to be out-of-date. This is often due to the OS relying on a particular version for system scripts, etc.

 

On some servers we have installed additional python versions and named them python3, python2, etc. If your server does not have these you can request and install or you can make a private python install to your shell account.

 

It is quick and easy to install your own python version to your shared hosting shell account.

 

1. Download python (change this to the version you need)

 

wget https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz

 

2. configure to use your local dirs:

 

./configure --prefix=$HOME/python

make

make install






Quickly install WordPress from the command line (7 easy steps)

Install wordpress from the command line:

Here’s the quickest way to install wordpress from the command line:

1. Get wordpress:
wget --quiet http://wordpress.org/latest.zip ; unzip -q latest.zip

2. Get rid of your old site and mv wordpress to your document root (or put it where-ever it is you want it)
mv www www-old ; mv wordpress www

3. Change to the wordpress directory
cd www

4. Rename the config file

mv wp-config-sample.php wp-config.php

5. Edit the config file, be sure to put in your db name, username and password in the code below

sed -i -e 's/database_name_here/YOUR_DB_NAME_HERE/' wp-config.php
sed -i -e 's/username_here/YOUR_USER_NAME_HERE/' wp-config.php
sed -i -e 's/password_here/YOUR_PASSWORD_HERE/' wp-config.php

6. Set your unique keys and salts

wget -q -O - https://api.wordpress.org/secret-key/1.1/salt/

you’ll get something like:

define('AUTH_KEY', 'Jcie-e]vC6!^;JHf5}ikA]k){#RWr&Sl6/Z-M,F=Y+4{G?dFc`=!E+bl^Mu!,c e');
define('SECURE_AUTH_KEY', '.o5oBJC|p[X4');
define('LOGGED_IN_KEY', 'TR_Nc m|w;5@e2EgA55$5:1U -NWd|tC_^M;oYt^3{j-4;P~oU#&bBBMvXH=m6i(');
define('NONCE_KEY', 'c}c E?V$C*T({;lm:(1K?+~AP`vM4< !rnounx~Qydz:n]7V< *98 6[+!d='); define('LOGGED_IN_SALT', 'pG}6d}~l3nbEHPD9$@?eSp

Do not copy the above into your wp-config.php - it is an example only and not safe to use

paste the output of this into wp-config.php

7. Load the install page into your browser, follow the steps and you are done!

Wordpress install screenshot

or as a near one-liner :

DB_USER=put_the_db_username_here ; DB_PASS=put_the_db_user_password_here ; DB_NAME=put_the_db_name_here ; wget --quiet http://wordpress.org/latest.zip ; unzip -q latest.zip ; mv www www-old ; mv wordpress www ; mv www/wp-config-sample.php www/wp-config.php ; sed -i -e "s/database_name_here/$DB_NAME/" www/wp-config.php ; sed -i -e "s/username_here/$DB_USER/" www/wp-config.php ; sed -i -e "s/password_here/$DB_PASS/" www/wp-config.php ; rm -f latest.zip ; wget -q -O - https://api.wordpress.org/secret-key/1.1/salt/

Fastest guide to git

Note: a few older servers may not have git installed. If you need git added to your server, contact support

Here is how to quickly store all your files in git:

1. ssh to the server

2. type:


cd ~/
git init
git config user.name "Your name here"
git config user.email "your-email@here.com"
git add .
git commit -m "Initial commit"

make some changes, then

cd ~/

If you have created new files, add them to git. Either add them all with :

git add .

or add them individually with:

git add file1 file2 path/to/file3 file4 long/path/to/this/file

etc.

Finally, commit your changes:


git commit -m "Version 2"

In all these examples we use git to backup our entire home directory by performing:

cd ~/

at the start of each checkin/add/etc.

There are many arguments against this and you are of course welcome (and perhaps even advised in most cases) to cd instead to the directory your project is in.

Git Branches

If you would like to make some changes to your working code (or have already made changes and want to revert back quickly), type:

git branch experimental

(you can use whatever name you like in place of “experimental”)

git checkout experimental

Make your changes (if you haven’t already made some), then type :

git commit -a

Your changes are now committed into the experimental branch.

To get back to your working code, type:

git checkout master

and you should be back to your working version of the code.

To totally abandon all your changes and go back to the last checked in version in your current branch:

git reset --hard HEAD

Linux Shell Host – What are my options?

phpwebhosting.com is a great choice for a Linux shell host. After you sign-up, put in a request for ssh and it will be enabled quickly (all new accounts need to be verified). All common unix shell tools are pre-installed and, best of all, the admins will install more for you on request. You also have compiler access so are free to do any custom installs into your account space.

Your account is a normal unix shell – no restricted shells here. subversion and git are both available for revision control. Background processes are allowed as long as they do not cause a problem for other users. Crontab is also available.

sftp gives the error “Received message too long”

Question:

sftp gives the error “Received message too long”

Answer:

Check your .bashrc file. You likely have something in your .bashrc that is sending output and killing sftp. Most items that send output belong in .bash_profile.

The primary difference between .bashrc and .bash_profile is that .bashrc is used for non-interactive logins (sftp, etc.) and .bash_profile is used for interactive logins.

Keep your .bashrc free of anything that would send output.