解决Maven工程依赖下载失败

使用代理

修改settings.xml, 添加如下代码,实际情况按自己的代理来填写

<proxies>
        <proxy>
            <id>ss</id>
            <active>true</active>
            <protocol>http</protocol>
            <host>127.0.0.1</host>
            <port>7890</port>
            <nonProxyHosts>127.0.0.1</nonProxyHosts>
        </proxy>
    </proxies>

删除maven下载的文件

cd /home/YourName/.m2/repository
find -name "*lastupdate*" | xargs rm -r

重新导入maven依赖。

使用Ubuntu搭建WordPress个人网站

首先进行资源更新

sudo apt update
sudo apt upgrade

安装Apache2

sudo apt install apache2

安装PHP及其组件

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install php7.4-fpm php7.4-cli php7.4-mysql php7.4-xml php7.4-gd php7.4-imagick php7.4-tidy php7.4-xmlrpc
sudo apt install libapache2-mod-php7.4

安装MySQL数据库

sudo apt install mysql-client mysql-server mysql-common

进入数据库

mysql -u root

弃用原root账户,创建新用户并授权

DROP USER 'root'@'localhost';
CREATE USER 'YourName'@'%' IDENTIFIED BY 'YourPassword';
GRANT ALL PRIVILEGES ON *.* TO 'YourName'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

安装PHPMYADMIN

sudo apt install phpmyadmin

过程中需要输入两次密码

配置Wordpress相关数据库

CREATE DATABASE wordpress;
CREATE USER 'wordpressadmin'@'%' IDENTIFIED BY 'YourPassword';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressadmin'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

获取Wordpress

WordPress中国官网获取下载链接

wget https://cn.wordpress.org/latest-zh_CN.zip
sudo apt install unzip
sudo unzip latest-zh_CN.zip

建立网页连接

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
sudo mv /var/www/html/index.html /var/www/html/index~.html
sudo mv wordpress/* /var/www/html/
sudo chmod -R 777 /var/www/html/

重启相关服务

sudo /etc/init.d/mysql restart
sudo systemctl restart apache2.service

现在在浏览器中输入服务器IP地址即可访问Wordpress安装页面,填入相关信息即可

关于Wordpress更新时需要账号密码的解决办法

cd /var/www/html/
sudo vi wp-config.php

在打开的文件中添加以下代码

define("FS_METHOD", "direct");  
define("FS_CHMOD_DIR", 0777);  
define("FS_CHMOD_FILE", 0777);

保存退出并重启服务

sudo systemctl restart apache2.service