Install Wordpress on SUSE: Difference between revisions

From Jwiki
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:SUSE]]
== Prequisites ==
== Prequisites ==


Line 10: Line 12:
echo '<html><body><h1>It works!</h1></body></html>' > /srv/www/htdocs/index.html
echo '<html><body><h1>It works!</h1></body></html>' > /srv/www/htdocs/index.html
echo -e '<VirtualHost *:80>\nDocumentRoot /srv/www/htdocs\n</VirtualHost>' > /etc/apache2/vhosts.d/_default.conf
echo -e '<VirtualHost *:80>\nDocumentRoot /srv/www/htdocs\n</VirtualHost>' > /etc/apache2/vhosts.d/_default.conf
</syntaxhighlight>
<syntaxhighlight lang="bash">
mkdir /srv/www/vhosts/
chown -R wwwrun:www /srv/www/
chmod 775 -R /srv/www/
</syntaxhighlight>
</syntaxhighlight>


Line 47: Line 55:
GRANT ALL PRIVILEGES ON  `example.com`.* TO 'example.com'@'localhost';
GRANT ALL PRIVILEGES ON  `example.com`.* TO 'example.com'@'localhost';
FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
</syntaxhighlight>
4. Install PhpMyAdmin (optional):
<syntaxhighlight lang="bash">
zypper install -y phpMyAdmin
</syntaxhighlight>
</syntaxhighlight>




== Install ==
== Install ==
1. Download latest Wordpress:
<syntaxhighlight lang="bash">
curl http://wordpress.org/latest.tar.gz -o /tmp/latest.tar.gz
</syntaxhighlight>
2. Extract it:
<syntaxhighlight lang="bash">
tar -xzvf /tmp/latest.tar.gz
</syntaxhighlight>
3. Move and rename the directory:
<syntaxhighlight lang="bash">
mv /tmp/wordpress /srv/www/vhosts/example.com
</syntaxhighlight>
4. Copy the initial config:
<syntaxhighlight lang="bash">
cp -p /srv/www/vhosts/example.com/wp-config-sample.php /srv/www/vhosts/example.com/wp-config.php 
</syntaxhighlight>
5. Edit the config:
<syntaxhighlight lang="bash">
vi /srv/www/vhosts/example.com/wp-config.php 
</syntaxhighlight>
6. Create Apache configuration:
<syntaxhighlight lang="bash">
cat > /etc/apache2/vhosts.d/example.com.conf << EOF
<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /srv/www/vhosts/example.com
    <Directory /srv/www/vhosts/example.com>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /srv/www/vhosts/example.com/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>
EOF
</syntaxhighlight>
7. Restart Apache:
<syntaxhighlight lang="bash">
systemctl reload apache2
</syntaxhighlight>


== Final steps ==
== Final steps ==


== Sources ==
== Sources ==

Latest revision as of 11:50, 29 August 2024


Prequisites

1. Install Apache:

zypper install -y apache2
echo '<html><body><h1>It works!</h1></body></html>' > /srv/www/htdocs/index.html
echo -e '<VirtualHost *:80>\nDocumentRoot /srv/www/htdocs\n</VirtualHost>' > /etc/apache2/vhosts.d/_default.conf
mkdir /srv/www/vhosts/
chown -R wwwrun:www /srv/www/
chmod 775 -R /srv/www/
systemctl enable apache2
systemctl start apache2

2. Install PHP:

zypper install -y php8 php-mysql php8-gd php8-mbstring apache2-mod_php8 php8-exif php8-fileinfo
a2enmod php8
systemctl restart apache2


3. Install MariaDB:

zypper install -y mariadb mariadb-client
systemctl enable mariadb 
systemctl start mariadb
CREATE DATABASE `example.com`;
CREATE USER 'example.com'@localhost IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON  `example.com`.* TO 'example.com'@'localhost';
FLUSH PRIVILEGES;

4. Install PhpMyAdmin (optional):

zypper install -y phpMyAdmin


Install

1. Download latest Wordpress:

curl http://wordpress.org/latest.tar.gz -o /tmp/latest.tar.gz


2. Extract it:

tar -xzvf /tmp/latest.tar.gz

3. Move and rename the directory:

mv /tmp/wordpress /srv/www/vhosts/example.com

4. Copy the initial config:

cp -p /srv/www/vhosts/example.com/wp-config-sample.php /srv/www/vhosts/example.com/wp-config.php

5. Edit the config:

vi /srv/www/vhosts/example.com/wp-config.php

6. Create Apache configuration:

cat > /etc/apache2/vhosts.d/example.com.conf << EOF
<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com

    DocumentRoot /srv/www/vhosts/example.com

    <Directory /srv/www/vhosts/example.com>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>

    <Directory /srv/www/vhosts/example.com/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>
EOF

7. Restart Apache:

systemctl reload apache2

Final steps

Sources