https://wiki.debian.org/WordPress
Vérifier le /etc/hosts
export PMYDBNAME="<nom_base_de_données>" export PMYDBUSER="<nom_utilisateur>" export PMYDBPW="<phrase_de_passe"
export HOTNAMEWP="www" export DOMAINWP="nom-de-domaine.com" export FQDNWP="$HOTNAMEWP.$DOMAINWP" echo "FQDN du serveur : $FQDNWP"
export ADMINMAIL="admin@nom-de-domaine.com"
apt-get install apache2 apache2.2-common curl mysql-common mysql-server mysql-client php5 libjs-cropper libphp-phpmailer libphp-snoopy php5-gd php5-mysql tinymce ssl-cert
Renseigner le mot de passe root mysql (mysql/root) et le renseigner dans le fichier keepass
cd /var/www mkdir -p $FQDNWP cd $FQDNWP wget --content-disposition http://wordpress.org/latest.tar.gz tar xfzp wordpress*.tar.gz rm wordpress*.tar.gz mv ./wordpress/* ./ rmdir ./wordpress/ chown -R www-data:www-data /var/www/$FQDNWP cat << 'EOF' > /var/www/$FQDNWP/.htaccess <FilesMatch ^wp-config.php$> deny from all </FilesMatch> EOF chown www-data:www-data /var/www/$FQDNWP/.htaccess chmod 640 /var/www/$FQDNWP/.htaccess
export MAKENEWDBFILE="/root/tmp_create_database.sql" cat << 'EOF' > $MAKENEWDBFILE CREATE DATABASE _DBNAME_; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON _DBNAME_.* TO _DBUSER_@localhost IDENTIFIED BY '_DBPW_'; FLUSH PRIVILEGES; EOF sed -i "s/_DBNAME_/$PMYDBNAME/g" $MAKENEWDBFILE sed -i "s/_DBUSER_/$PMYDBUSER/g" $MAKENEWDBFILE sed -i "s/_DBPW_/$PMYDBPW/g" $MAKENEWDBFILE cat $MAKENEWDBFILE | mysql --defaults-extra-file=/etc/mysql/debian.cnf rm $MAKENEWDBFILE
/!\ suivre le howto staging apache2 /!\
cat << 'EOF' > /etc/apache2/sites-available/$FQDNWP <VirtualHost *:80> ServerName _FQDN_ ServerAdmin _ADMINMAIL_ Options -All DocumentRoot /var/www/_FQDN_/ php_admin_value open_basedir /tmp/:/usr/share/php/:/var/www/_FQDN_/ <Directory /> AllowOverride None Order Deny,Allow Deny from all <Limit POST GET> Order allow,deny allow from all </Limit> <LimitExcept POST GET> Order deny,allow deny from all </LimitExcept> </Directory> <Directory /var/www/_FQDN_/> <LimitExcept POST GET> deny from all </LimitExcept> AllowOverride Limit FileInfo Options Options +SymLinksIfOwnerMatch DirectoryIndex index.php Order allow,deny Allow from all </Directory> </VirtualHost> EOF sed -i "s/_FQDN_/$FQDNWP/g" /etc/apache2/sites-available/$FQDNWP sed -i "s/_ADMINMAIL_/$ADMINMAIL/g" /etc/apache2/sites-available/$FQDNWP a2ensite $FQDNWP a2enmod rewrite service apache2 stop service apache2 start **RQ :** Si le seul serveur présent est wordpress, alors désactiver le site default : a2dissite default; service apache2 stop; service apache2 start ===== config wordpress ===== <code bash> export WPCONFFILE="/var/www/$FQDNWP/config.php" cat << 'EOF' > $WPCONFFILE <?php define('DB_NAME', '_PMYDBNAME_'); define('DB_USER', '_PMYDBUSER_'); define('DB_PASSWORD', '_PMYDBPW_'); define('DB_HOST', 'localhost'); define('WP_CONTENT_DIR', '/var/www/_FQDNWP_/wp-content'); define('FS_METHOD', 'direct'); define('AUTH_KEY', '_SALT1_'); define('SECURE_AUTH_KEY', '_SALT2_'); define('LOGGED_IN_KEY', '_SALT3_'); define('NONCE_KEY', '_SALT4_'); define('AUTH_SALT', '_SALT5_'); define('SECURE_AUTH_SALT', '_SALT6_'); define('LOGGED_IN_SALT', '_SALT7_'); define('NONCE_SALT', '_SALT8_'); $table_prefix = '_DBTBPREFIX_'; ?> EOF export SALT1=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) export SALT2=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) export SALT3=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) export SALT4=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) export SALT5=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) export SALT6=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) export SALT7=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) export SALT8=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) export DBTBPREFIX=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1) sed -i "s/_PMYDBNAME_/$PMYDBNAME/g" $WPCONFFILE sed -i "s/_PMYDBUSER_/$PMYDBUSER/g" $WPCONFFILE sed -i "s/_PMYDBPW_/$PMYDBPW/g" $WPCONFFILE sed -i "s/_FQDNWP_/$FQDNWP/g" $WPCONFFILE sed -i "s/_SALT1_/$SALT1/g" $WPCONFFILE sed -i "s/_SALT2_/$SALT2/g" $WPCONFFILE sed -i "s/_SALT3_/$SALT3/g" $WPCONFFILE sed -i "s/_SALT4_/$SALT4/g" $WPCONFFILE sed -i "s/_SALT5_/$SALT5/g" $WPCONFFILE sed -i "s/_SALT6_/$SALT6/g" $WPCONFFILE sed -i "s/_SALT7_/$SALT7/g" $WPCONFFILE sed -i "s/_SALT8_/$SALT8/g" $WPCONFFILE sed -i "s/_DBTBPREFIX_/$DBTBPREFIX/g" $WPCONFFILE chmod 640 $WPCONFFILE chown root:www-data $WPCONFFILE
sed -i "s/^upload_max_filesize.*/upload_max_filesize = 64M/g" /etc/php5/apache2/php.ini sed -i "s/^post_max_size.*/post_max_size = 64M/g" /etc/php5/apache2/php.ini
Se rendre sur :
echo "http://$FQDNWP"
echo -e “\nDatabase Name : $PMYDBNAME\nUser Name : $PMYDBUSER\nPassword : $PMYDBPW\nDatabase Host : localhost\nTable Prefix : $DBTBPREFIX”