The ability to develop software productively requires the ability to manage your development, test and production environments. Managing a production environment is best left to a professional, trained system administrator. But managing a development environment is something that most developers like to do themselves because it gives them the flexibility to set it up however they like.
This can become a tremendous time sync however if you’re working on multiple projects in parallel, each of which requires a slightly different development environment. Settings and configurations can conflict. Without the know-how to quickly tweak settings and modify your environment you’ll end up losing many hours to figuring out how to just get a working development environment.
How-Tos
Export and import a MySQL database in one step
Use mysqldump to export the file and mysql to import it. Pipe the output of a into b and you’ve copied your database from servera to serverb.
Securely Copy a File from a Linux Server to your Workstation
* Requires a *nix shell on both ends.
scp me@server:/path/to/file local.file.name
Set up a local Apache Virtual Host
Be sure you have this fragment in your Apache config somewhere before including your virtual host config file (which in recent versions of Apache is included via files other than httpd.conf.
NameVirtualHost *:80
Then add the snippet below wherever your virtual-hosts are defined (can be anywhere inside your configuration, but is often done on Linux via sites-available/sites-enabled and other times via /path/to/apache/conf/extra/httpd-vhosts.conf.
<VirtualHost *:80>
ServerName appname.local
DocumentRoot /path/to/app
<Directory /path/to/app>
Options All
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
After making this change you’ll need to restart Apache (see how) and map the new hostname (see how).
Then point your browser to http://appname.local/ and you’re in business.
Restart Apache
On *nix (including OSX):
sudo apache2ctl graceful
On Windows
Either restart the Apache2 service (see: How to Restart a Windows Service).
Restart a Windows Service
Right-click “My Computer”
Click “Manage”
Click “Services” under “Services and Applications”
Select the service you want to restart and click “Restart”
Map a virtual host name to localhost
To get http://app.local to point to your local machine:
On *nix
Add the following to /etc/hosts:
127.0.0.1 app.local
On Windows
Add the following to C:/Windows/system32/drivers/etc/hosts:
127.0.0.1 app.local
Conclusion
There are countless individual, simple tasks which you’ll need to perform over and over as a developer. These are just a few that I use more than others. So take these, put them in your bag of tricks and build great apps. Enjoy!
I've got a masters degree in computer science and over 10 years of experience building web-based systems using Java/J2EE, Ruby, Rails and PHP. I'm a strong believer in the effectiveness of Agile Methods. Read more »
6 Must-Know Sys-Admin How-Tos for Web Developers
The ability to develop software productively requires the ability to manage your development, test and production environments. Managing a production environment is best left to a professional, trained system administrator. But managing a development environment is something that most developers like to do themselves because it gives them the flexibility to set it up however they like.
This can become a tremendous time sync however if you’re working on multiple projects in parallel, each of which requires a slightly different development environment. Settings and configurations can conflict. Without the know-how to quickly tweak settings and modify your environment you’ll end up losing many hours to figuring out how to just get a working development environment.
How-Tos
Export and import a MySQL database in one step
Use mysqldump to export the file and mysql to import it. Pipe the output of a into b and you’ve copied your database from servera to serverb.
Securely Copy a File from a Linux Server to your Workstation
* Requires a *nix shell on both ends.
Set up a local Apache Virtual Host
Be sure you have this fragment in your Apache config somewhere before including your virtual host config file (which in recent versions of Apache is included via files other than httpd.conf.
Then add the snippet below wherever your virtual-hosts are defined (can be anywhere inside your configuration, but is often done on Linux via sites-available/sites-enabled and other times via /path/to/apache/conf/extra/httpd-vhosts.conf.
<VirtualHost *:80> ServerName appname.local DocumentRoot /path/to/app <Directory /path/to/app> Options All AllowOverride All Order deny,allow Allow from all </Directory> </VirtualHost>After making this change you’ll need to restart Apache (see how) and map the new hostname (see how).
Then point your browser to http://appname.local/ and you’re in business.
Restart Apache
On *nix (including OSX):
On Windows
Either restart the Apache2 service (see: How to Restart a Windows Service).
Restart a Windows Service
Map a virtual host name to localhost
To get http://app.local to point to your local machine:
On *nix
Add the following to /etc/hosts:
On Windows
Add the following to C:/Windows/system32/drivers/etc/hosts:
Conclusion
There are countless individual, simple tasks which you’ll need to perform over and over as a developer. These are just a few that I use more than others. So take these, put them in your bag of tricks and build great apps. Enjoy!