issue101:labo_linux_-_drupal_7
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue101:labo_linux_-_drupal_7 [2015/09/29 00:03] – créée d52fr | issue101:labo_linux_-_drupal_7 [2015/10/11 14:17] (Version actuelle) – fcm_-_ekel | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | This article is an updated version of some notes I made years ago about installing | + | ====== Labo Linux - Drupal |
- | From the Drupal website: “Drupal | + | **This article |
- | I have a habit of forgetting tasks I don’t do everyday. When it’s a task that requires quite a few steps, I like to document | + | From the Drupal website: “Drupal is a free software package that allows you to easily organize, manage and publish your content, with an endless variety |
- | For the purpose of this article, I’m assuming access to the command line of a fresh install of Ubuntu Server | + | Cet article |
- | Step #1 - Update Ubuntu Server: | + | Extrait du site internet de Drupal : « Drupal est un paquet logiciel gratuit vous permettant d' |
+ | |||
+ | **I have a habit of forgetting tasks I don’t do everyday. When it’s a task that requires quite a few steps, I like to document the steps because I find that instructions provided by projects sometimes skip steps or make assumptions I don’t know. Installing and configuring Apache alone can be quite a task, particularly if you’re setting up multiple domains or have special library requirements. Add the complexity of learning MySQL (many people learn phpmyadmin) and things get a bit more challenging.** | ||
+ | |||
+ | J'ai l' | ||
+ | |||
+ | **For the purpose of this article, I’m assuming access to the command line of a fresh install of Ubuntu Server 14.04. | ||
+ | |||
+ | Step #1 - Update Ubuntu Server:** | ||
+ | |||
+ | Pour les besoins de cet article, je pars du principe qu'on travaille en ligne de commande sur une installation neuve d' | ||
+ | |||
+ | Étape 1 – Mise à jour d' | ||
sudo apt-get update | sudo apt-get update | ||
Ligne 13: | Ligne 25: | ||
sudo apt-get dist-upgrade | sudo apt-get dist-upgrade | ||
- | Step #2 - Install Apache, MySQL, PHP, and some basic PHP libraries: | + | **Step #2 - Install Apache, MySQL, PHP, and some basic PHP libraries: |
sudo apt-get install apache2 mysql-server php5 php5-mysql php5-gd | sudo apt-get install apache2 mysql-server php5 php5-mysql php5-gd | ||
Ligne 19: | Ligne 31: | ||
Several other dependencies are automatically added when you install Apache, MySQL and the basic PHP libraries. | Several other dependencies are automatically added when you install Apache, MySQL and the basic PHP libraries. | ||
- | During the install process, you’ll be asked to enter a password for the root user to access MySQL databases. The password you use should be long and complex, especially if you plan on exposing the site to the Internet (as opposed to Intranet). | + | During the install process, you’ll be asked to enter a password for the root user to access MySQL databases. The password you use should be long and complex, especially if you plan on exposing the site to the Internet (as opposed to Intranet).** |
+ | |||
+ | Étape 2 – Installer Apache, MySQL, PHP et quelques bibliothèques PHP de base | ||
+ | |||
+ | sudo apt-get install apache2 mysql-server php5 php5-mysql php5-gd | ||
+ | |||
+ | Quelques autres dépendances sont automatiquement ajoutées quand on installe Apache, MySQL, PHP et les bibliothèques de base de PHP. | ||
+ | |||
+ | Pendant le processus d' | ||
- | When the installation finishes you may notice a message similar to: “apache2 could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message.” | + | **When the installation finishes you may notice a message similar to: “apache2 could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message.” |
We need to set the fully qualified domain name (FQDN). | We need to set the fully qualified domain name (FQDN). | ||
Ligne 28: | Ligne 48: | ||
The FQDN consists of 2 parts, the hostname of the computer running the server, and the domain name. There are a couple of ways you can solve the FQDN problem, the first is to set the FQDN with the 127.0.1.1 I.P. address in /etc/hosts (in this case my hostname is drupal8). | The FQDN consists of 2 parts, the hostname of the computer running the server, and the domain name. There are a couple of ways you can solve the FQDN problem, the first is to set the FQDN with the 127.0.1.1 I.P. address in /etc/hosts (in this case my hostname is drupal8). | ||
+ | |||
+ | 127.0.1.1 drupal8** | ||
+ | |||
+ | Quand l' | ||
+ | |||
+ | Nous avons donc besoin de donner le nom de domaine complètement qualifié (FQDN). | ||
+ | |||
+ | Étape 3 – Donner une valeur au nom de domaine complètement qualifié | ||
+ | |||
+ | Le FQDN comporte deux parties : Le nom d' | ||
127.0.1.1 drupal8 | 127.0.1.1 drupal8 | ||
- | The second, and preferred method is to set the ServerName directive in / | + | **The second, and preferred method is to set the ServerName directive in / |
ServerName localhost | ServerName localhost | ||
Ligne 40: | Ligne 70: | ||
Lastly we need to reload Apache: | Lastly we need to reload Apache: | ||
+ | |||
+ | sudo service apache2 reload** | ||
+ | |||
+ | La seconde façon, préférable, | ||
+ | |||
+ | ServerName localhost | ||
+ | |||
+ | Ensuite, nous devons valider le fichier de configuration. Il est important de noter que le fichier de configuration doit se terminer par .conf. Nous pouvons valider le fichier de configuration à l'aide de a2enconf : | ||
+ | |||
+ | sudo a2enconf fqdn | ||
+ | |||
+ | Puis nous devons recharger Apache : | ||
sudo service apache2 reload | sudo service apache2 reload | ||
- | Step #4 - Download and unpack Drupal and move it to / | + | **Step #4 - Download and unpack Drupal and move it to / |
+ | |||
+ | For the purpose of this article I’m assuming you’re just running a single website on a single server. If you plan on running multiple sites on the server your setup will be a little different. For multi-site setups, you’ll need to know a bit about modifying apache configuration files in / | ||
+ | |||
+ | Étape 4 – Télécharger et décompresser Drupal et le déplacer dans / | ||
- | For the purpose of this article | + | Dans le cadre de cet article, nous partons du principe que nous installons un site Internet unique sur un seul serveur. Si vous projetez d' |
- | The simplest method to download Drupal is to use wget. Version 7.39 is the current stable version at the time of this article. | + | **The simplest method to download Drupal is to use wget. Version 7.39 is the current stable version at the time of this article. |
wget http:// | wget http:// | ||
Ligne 55: | Ligne 101: | ||
tar -zxvf drupal-7.39.tar.gz | tar -zxvf drupal-7.39.tar.gz | ||
- | At this step, you may want to change into the drupal-7.39/ | + | At this step, you may want to change into the drupal-7.39/ |
+ | La méthode la plus simple pour télécharger Drupal est d' | ||
+ | |||
+ | wget http:// | ||
+ | |||
+ | Ensuite on décompresse Drupal 7 : | ||
+ | |||
+ | tar -zxvf drupal-7.39.tar.gz | ||
+ | |||
+ | Arrivé là, il serait bon d' | ||
sudo mv drupal-7.39/ | sudo mv drupal-7.39/ | ||
Ligne 62: | Ligne 117: | ||
sudo mv drupal-7.39/ | sudo mv drupal-7.39/ | ||
- | If your server is also your desktop machine (generally not a great idea), you can check it out in a web browser by typing http:// | + | **If your server is also your desktop machine (generally not a great idea), you can check it out in a web browser by typing http:// |
+ | |||
+ | Si votre serveur est aussi votre ordinateur de bureau (plutôt déconseillé), | ||
- | Step #5 - Create the MySQL database to hold the drupal files: | + | **Step #5 - Create the MySQL database to hold the drupal files: |
Before we can set drupal up, it needs a database to write to. MySQL is one of the most common databases in the world and a great choice here. You can use a web interface to mysql, but I’ve always preferred to just run mysql itself and issue commands: | Before we can set drupal up, it needs a database to write to. MySQL is one of the most common databases in the world and a great choice here. You can use a web interface to mysql, but I’ve always preferred to just run mysql itself and issue commands: | ||
Ligne 71: | Ligne 128: | ||
The -u switch tells mysql the user is the root user. The -p switch is used for passing the password, but if you don’t put one after the -p, it will prompt you for the password (a better idea if you work with other people around). A tip worth remembering is that mysql commands are terminated with a semicolon. At the mysql> prompt, create a database with whatever name you want, I tend to use d_sitename: | The -u switch tells mysql the user is the root user. The -p switch is used for passing the password, but if you don’t put one after the -p, it will prompt you for the password (a better idea if you work with other people around). A tip worth remembering is that mysql commands are terminated with a semicolon. At the mysql> prompt, create a database with whatever name you want, I tend to use d_sitename: | ||
+ | |||
+ | create database d_test;** | ||
+ | |||
+ | Étape 5 – Créer la base de données MySQL qui contiendra les fichiers Drupal | ||
+ | |||
+ | Avant de pouvoir démarrer Drupal, nous allons avoir besoin d'une base de données dans laquelle nous pourrons écrire. MySQL est l'une des bases de données les plus répandues dans le monde et un excellent choix en ce qui nous concerne. Vous pouvez utiliser une interface Internet pour commander MySQL, mais j'ai toujours préféré utiliser directement des commandes MySQL en lançant le logiciel dans un terminal : | ||
+ | |||
+ | mysql -u root -p | ||
+ | |||
+ | L' | ||
create database d_test; | create database d_test; | ||
- | If the command is successful, you’ll see a “Query OK, 1 row affected” message. To see what other databases exist, use the show databases; command. Next we want to grant rights to access the database to a user who exists on the system. In my Ubuntu installation I used the username charles. The proper rights for the database can be found in the INSTALL.mysql.txt file. | + | **If the command is successful, you’ll see a “Query OK, 1 row affected” message. To see what other databases exist, use the show databases; command. Next we want to grant rights to access the database to a user who exists on the system. In my Ubuntu installation I used the username charles. The proper rights for the database can be found in the INSTALL.mysql.txt file. |
grant select, insert, update, delete, create, drop, index, alter, create temporary tables on d_test.* TO ‘charles’@’localhost’ IDENTIFIED BY ‘MyExtra0rdinarilyL0ngPaddw0rd’; | grant select, insert, update, delete, create, drop, index, alter, create temporary tables on d_test.* TO ‘charles’@’localhost’ IDENTIFIED BY ‘MyExtra0rdinarilyL0ngPaddw0rd’; | ||
- | Don’t forget the .* after your database name. I did this several times when I was first starting to use mysql and couldn’t figure out why I kept getting an error. | + | Don’t forget the .* after your database name. I did this several times when I was first starting to use mysql and couldn’t figure out why I kept getting an error. ** |
+ | |||
+ | Si la commande s'est bien passée, vous obtiendrez le message « Query OK, 1 row affected ». Pour voir s'il existe d' | ||
+ | |||
+ | grant select, insert, update, delete, create, drop, index, alter, create temporary tables on d_test.* TO ‘charles’@’localhost’ IDENTIFIED BY ‘MonMotDePasseExtraordinairementLong’; | ||
+ | |||
+ | N' | ||
- | Next quit mysql by issuing the quit; command. If you run ls -al on the files in / | + | **Next quit mysql by issuing the quit; command. If you run ls -al on the files in / |
sudo chown -R :www-data * | sudo chown -R :www-data * | ||
sudo chown :www-data .htaccess | sudo chown :www-data .htaccess | ||
- | If you want to specify a different username, specify it before the colon. For example: | + | If you want to specify a different username, specify it before the colon. For example:** |
+ | |||
+ | Ensuite il faut sortir de MySQL par la commande « quit; ». Si vous faites un ls -al dans / | ||
+ | |||
+ | sudo chown -R :www-data * | ||
+ | |||
+ | sudo chown :www-data .htaccess | ||
+ | |||
+ | Si vous souhaitez donner un autre nom d' | ||
sudo chown -R charles: | sudo chown -R charles: | ||
- | Be a bit careful about the files you’re changing permissions on. Make sure you’re in the path where your drupal files are. Drupal also needs to be able to write to the configuration file in the sites/ | + | **Be a bit careful about the files you’re changing permissions on. Make sure you’re in the path where your drupal files are. Drupal also needs to be able to write to the configuration file in the sites/ |
sudo chmod a+w sites/ | sudo chmod a+w sites/ | ||
- | It’s important that this write permission be removed immediately after the installation or your server could get hacked! | + | It’s important that this write permission be removed immediately after the installation or your server could get hacked!** |
- | Drupal has a default.settings.php file in the sites/ | + | Faites bien attention aux fichiers pour lesquels vous changez la permission. Soyez sûrs d' |
+ | |||
+ | sudo chmod a+w sites/ | ||
+ | |||
+ | Il est important de supprimer cette permission d' | ||
+ | |||
+ | **Drupal has a default.settings.php file in the sites/ | ||
sudo cp sites/ | sudo cp sites/ | ||
Ligne 101: | Ligne 188: | ||
(Note: the above command is all one line with a space between default.settings.php and sites/ | (Note: the above command is all one line with a space between default.settings.php and sites/ | ||
- | sudo chmod a+w sites/ | + | sudo chmod a+w sites/ |
- | We’re almost ready to install drupal, there’s one more step we need before running the installation PHP script, enabling mod_rewrite. Mod_rewrite is an apache module that enables rewriting of urls so they look more clean. For example: Instead of your browser going to yoursite.com/ | + | Dans le répertoire sites/ |
+ | sudo cp sites/ | ||
+ | |||
+ | (Notez bien que la commande ci-dessus tient en une seule ligne avec une espace entre default.settings.php et sites/ | ||
+ | |||
+ | sudo chmod a+w sites/ | ||
+ | |||
+ | **We’re almost ready to install drupal, there’s one more step we need before running the installation PHP script, enabling mod_rewrite. Mod_rewrite is an apache module that enables rewriting of urls so they look more clean. For example: Instead of your browser going to yoursite.com/ | ||
sudo a2enmod rewrite | sudo a2enmod rewrite | ||
Because mod_rewrite affects apache a restart is needed. | Because mod_rewrite affects apache a restart is needed. | ||
+ | |||
+ | sudo service apache2 restart** | ||
+ | |||
+ | Nous sommes presque prêts à installer Drupal, mais il faut activer mod-rewrite avant de lancer le script PHP d' | ||
+ | |||
+ | sudo a2enmod rewrite | ||
+ | |||
+ | Comme le mode rewrite affecte Apache, il est nécessaire de le relancer. | ||
sudo service apache2 restart | sudo service apache2 restart | ||
- | Step #6 - Start the drupal install from a browser: | + | **Step #6 - Start the drupal install from a browser: |
The next step is to run the install.php file from a browser. If you’ve eliminated the index.html (not index.php) file, you should be redirected to the install.php file when you open the URL to your web server. I use Linux almost exclusively most of the time, but if you’re using a Windows machine to access your Linux web server, you may need to tell the Windows machine hosts file which I.P. address your Linux server resides on. On Windows, this file is C: | The next step is to run the install.php file from a browser. If you’ve eliminated the index.html (not index.php) file, you should be redirected to the install.php file when you open the URL to your web server. I use Linux almost exclusively most of the time, but if you’re using a Windows machine to access your Linux web server, you may need to tell the Windows machine hosts file which I.P. address your Linux server resides on. On Windows, this file is C: | ||
- | Choose Standard Installation. English is the built-in language. Other languages can be added and there’s a link on how to do this on the installation page. The INSTALL.txt file covers installing other languages. For the moment click Save and Continue. | + | Choose Standard Installation. English is the built-in language. Other languages can be added and there’s a link on how to do this on the installation page. The INSTALL.txt file covers installing other languages. For the moment click Save and Continue.** |
- | If all the steps above have been completed correctly you’ll see the Drupal | + | Étape 6 – Lancer l' |
- | Enter the database information from the earlier database you created into the database configuration page and click Save and Continue. | + | L' |
- | At this point Drupal will write the settings to the settings.php config file. We can now safely remove write permissions on this file and the sites/ | + | Choisissez l' |
+ | |||
+ | **If all the steps above have been completed correctly you’ll see the Drupal database configuration screen. If write permission is not set on sites/ | ||
+ | |||
+ | Enter the database information from the earlier database you created into the database configuration page and click Save and Continue.** | ||
+ | |||
+ | Si toutes les étapes ci-dessus se sont déroulées correctement, | ||
+ | |||
+ | Entrez les informations de base de données en suivant celles que vous aviez indiquées précédemment [Ndt : sur la base MySQL] et cliquez sur Save and Continue. | ||
+ | |||
+ | **At this point Drupal will write the settings to the settings.php config file. We can now safely remove write permissions on this file and the sites/ | ||
sudo chmod go-w sites/ | sudo chmod go-w sites/ | ||
Ligne 129: | Ligne 241: | ||
The last step in setting up our Drupal installation is to enter your site information, | The last step in setting up our Drupal installation is to enter your site information, | ||
- | Now you can proceed to log into your newly created Drupal site. | + | Now you can proceed to log into your newly created Drupal site.** |
- | This article has covered a basic installation of Drupal. Some of the concepts, such as creating a mySQL database, enabling mod_rewrite, | + | Drupal va maintenant enregistrer les réglages dans le fichier de configuration settings.php. Le moment est venu de supprimer les permissions d' |
+ | |||
+ | sudo chmod go-w sites/ | ||
+ | |||
+ | sudo chmod go-w sites/ | ||
+ | |||
+ | La dernière étape dans le réglage de notre installation Drupal sera d' | ||
+ | |||
+ | Vous pouvez maintenant vous connecter sur votre nouveau site Drupal. | ||
+ | |||
+ | **This article has covered a basic installation of Drupal. Some of the concepts, such as creating a mySQL database, enabling mod_rewrite, | ||
If you get stuck during the process of installing Drupal, there are several good resources: | If you get stuck during the process of installing Drupal, there are several good resources: | ||
• The INSTALL.txt and README.txt files in the drupal-7.39/ | • The INSTALL.txt and README.txt files in the drupal-7.39/ | ||
• Drupal’s Quick Install for Beginners: https:// | • Drupal’s Quick Install for Beginners: https:// | ||
• Apache virtual hosts examples: http:// | • Apache virtual hosts examples: http:// | ||
- | • 2bits.com - Besides having developed more than 30 modules for Drupal and being a server tuning company, 2bits has a lot of useful articles on Drupal - http:// | + | • 2bits.com - Besides having developed more than 30 modules for Drupal and being a server tuning company, 2bits has a lot of useful articles on Drupal - http:// |
+ | |||
+ | Cet article traite d'une installation basique de Drupal. Certain des principes tels que la création d'une base de données MySQL, la mise en place de mod-rewrite, | ||
+ | |||
+ | Si vous vous trouvez bloqué durant l' | ||
+ | |||
+ | • Les fichiers INSTALL.txt et README.txt dans le répertoire drupal-7.39/ | ||
+ | |||
+ | • Installation rapide de Drupal pour les débutants : | ||
+ | https:// | ||
+ | |||
+ | • Les exemples d' | ||
+ | http:// | ||
+ | |||
+ | • 2bits.com. Au-delà du fait d' |
issue101/labo_linux_-_drupal_7.1443477783.txt.gz · Dernière modification : 2015/09/29 00:03 de d52fr