Install and configure LAMP and Trac + SVN on Ubuntu
After reading this article , I realized that Trac + SVN will be very helpful in my work and decided to configure this bundle on my machine.
Recently, I use Ubuntu Linux , because the installation and configuration took place taking into account the features of this system. I have already installed LAMP , as well as inadyn . As a result, I got a fairly flexible and convenient system for managing my projects, which has access over the network. I wonder how to do it? (a bonus awaits at the end;) I
advise newcomers to go through the Seven Steps from mdevils
We open the console and write:
Now you have the Apache, PHP and MySQL web server installed, as well as a module for working with databases. If you need additional modules for PHP, then they are easy to install, for example:
There are commands for managing Apache modules and virtual hosts: a2enmod (turns on the module), a2ensite (turns on the host), a2dismod and a2dissite (turns off the module and host).
Alt + F2
there we write the familiar
Open the browser:
http: // localhost - to check the operation of the Apache
http: //localhost/phpinfo.php - to check the PHP
Our beloved
Alt + F2 module itself;
Change AllowOverride None to AllowOverride All , like this:
Alt + F2
change the first two lines to: Now access to it will occur only on the 80th port. Alt + F2
And here on 443, the SSL port
https: // localhost - check (it will most likely say that the certificate is incorrect)
And so that Apache does not swear on reboot:
Alt + F2
So, we now have a ready-made web server with PHP and MySQL.
There are several approaches to organizing repositories, you can use a new repository for each project, or you can use one repository for several projects. The first method is better suited for large companies and for the work of an average group of developers on a project so as not to get confused in a large data stream; the second is simpler, and better suited for freelancers and small studios, and I settled on it.
Now let's create a rule for Apache:
Alt + F2
Repeat almost identical operations, only for Trac
Alt + F2
That's all. In my opinion, I forgot nothing :)
Total:
http: // localhost - normal access
https: // localhost - secure access
http: // localhost / svn - SVN, requires authorization
http: // localhost / trac - Trac
http itself: // localhost / trac / login - login to Trac, requires authorization
Many of us have broadband Internet access, you can use your IP address to access your configured server. But I, for one, don’t like this. For such purposes, there is a fairly convenient DynDNS service . After registration, you can create your domain and bind it to your address. My address changes dynamically, I do not want to edit it on the site every time. To do this, there is a small inadyn client
Alt + F2
Now we need to add it to the crontab so that it starts automatically add the line, save and exit - check whether it is recorded - see if it is running or not
in one of the following articles I will talk about configuring Eclipse to work with PHP and Subverion.
PS thanks to the people from this topic for raising karma to the level of writing posts;)
Recently, I use Ubuntu Linux , because the installation and configuration took place taking into account the features of this system. I have already installed LAMP , as well as inadyn . As a result, I got a fairly flexible and convenient system for managing my projects, which has access over the network. I wonder how to do it? (a bonus awaits at the end;) I
advise newcomers to go through the Seven Steps from mdevils
Install Apache + PHP + MySQL
We open the console and write:
sudo aptitude update
sudo aptitude install apache2 php5 php5-mysql mysql-server
Now you have the Apache, PHP and MySQL web server installed, as well as a module for working with databases. If you need additional modules for PHP, then they are easy to install, for example:
sudo aptitude install php5-gd php5-imagick php5-xsl
- installs the GD, Imagick, XSL libraries. mysqladmin -u root password ваш_пароль_для_root
- sets the password for the administrator account to access the database.Customization
There are commands for managing Apache modules and virtual hosts: a2enmod (turns on the module), a2ensite (turns on the host), a2dismod and a2dissite (turns off the module and host).
sudo a2enmod php5
- turn on the PHP module sudo /etc/init.d/apache2 force-reload
- restart Apache Alt + F2
gksu gedit /var/www/phpinfo.php
there we write the familiar
, save and close. Open the browser:
http: // localhost - to check the operation of the Apache
http: //localhost/phpinfo.php - to check the PHP
Our beloved mod_rewrite
sudo a2enmod rewrite
- activate the Alt + F2 module itself;
gksu gedit /etc/apache2/sites-available/default
Change AllowOverride None to AllowOverride All , like this:
Options FollowSymLinks AllowOverride All
sudo /etc/init.d/apache2 force-reload
- yes, the server needs to be restarted after making changes to the settings :)Do you need SSL? You are welcome
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/apache.pem
- create a certificate sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
- copy the settings for the future host Alt + F2
gksu gedit /etc/apache2/sites-available/default
change the first two lines to: Now access to it will occur only on the 80th port. Alt + F2
NameVirtualHost *:80
gksu gedit /etc/apache2/sites-available/ssl
NameVirtualHost *: 443... DocumentRoot ... SSLEngine on SSLCertificateFile /etc/apache2/apache.pem
And here on 443, the SSL port
a2enmod ssl
- turn on the SSL module a2ensite ssl
- turn on the host sudo /etc/init.d/apache2 force-reload
- it's time to remember, restart the Apache. https: // localhost - check (it will most likely say that the certificate is incorrect)
And so that Apache does not swear on reboot:
Alt + F2
gksu gedit /etc/apache2/httpd.conf
ServerName localhost
So, we now have a ready-made web server with PHP and MySQL.
What about Trac and SVN?
There are several approaches to organizing repositories, you can use a new repository for each project, or you can use one repository for several projects. The first method is better suited for large companies and for the work of an average group of developers on a project so as not to get confused in a large data stream; the second is simpler, and better suited for freelancers and small studios, and I settled on it.
Subversion
sudo apt-get install trac libapache2-svn subversion python-subversion libapache2-mod-python
- install the necessary components sudo a2enmod mod_python
- enable the module for working with Python sudo groupadd svn
- create a group for working with SVNsudo usermod -a -G svn имя_вашего_пользователя
- add your user to the created group sudo usermod -a -G svn www-data
- add the Apache user to the group sudo mkdir /var/svn
- a folder for the future repository sudo svnadmin create /var/svn
- create the repository itself sudo chown -R www-data:svn /var/svn
- change the folder permissions for users to access from SVN groups sudo chmod -R g+ws /var/svn
sudo htpasswd -c -m /etc/apache2/svn.htpasswd имя_вашего_пользователя
- create a password that will later be used in Apache to access the folder Now let's create a rule for Apache:
Alt + F2
gksu gedit /etc/apache2/conf.d/svn
DAV svn SVNPath / var / svn AuthType Basic AuthName "SVN Repositories" AuthUserFile /etc/apache2/svn.htpasswd Require valid-user
Trac
Repeat almost identical operations, only for Trac
sudo mkdir /var/trac
sudo trac-admin /var/trac initenv
sudo chown -R www-data:svn /var/trac
sudo chmod -R g+ws /var/trac
sudo htpasswd -c -m /etc/apache2/trac.htpasswd имя_вашего_пользователя
Alt + F2
gksu gedit /etc/apache2/conf.d/trac
AuthType Basic AuthName "Projects" AuthUserFile /etc/apache2/trac.htpasswd Require valid-user SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracEnv / var / trac PythonOption TracUriRoot / trac
That's all. In my opinion, I forgot nothing :)
Total:
http: // localhost - normal access
https: // localhost - secure access
http: // localhost / svn - SVN, requires authorization
http: // localhost / trac - Trac
http itself: // localhost / trac / login - login to Trac, requires authorization
Promised Bonus
Many of us have broadband Internet access, you can use your IP address to access your configured server. But I, for one, don’t like this. For such purposes, there is a fairly convenient DynDNS service . After registration, you can create your domain and bind it to your address. My address changes dynamically, I do not want to edit it on the site every time. To do this, there is a small inadyn client
sudo aptitude install inadyn
- install Alt + F2
gksu gedit /etc/inadyn.conf
- create a configuration file--username your_name in the DynDNS system --password your_varol --update_period 60000 --alias name of your host --background
sudo /usr/sbin/inadyn
- start the client Now we need to add it to the crontab so that it starts automatically add the line, save and exit - check whether it is recorded - see if it is running or not
export EDITOR=gedit
sudo crontab -e
@reboot /usr/sbin/inadyn
sudo crontab -l
ps -A | grep inadyn
Thanks for attention
in one of the following articles I will talk about configuring Eclipse to work with PHP and Subverion.
PS thanks to the people from this topic for raising karma to the level of writing posts;)