下载地址
https://developer.harmonyos.com/cn/develop/deveco-studio#download
根据自己的需要下载对应的安装包
安装在windows环境下,将下载下来的安装包解压缩之后,运行exe文件
选择安装路径
创建桌面菜单和添加到系统path
创建开始菜单目录
是否现在重启,安装完成
运行DevEco,是否导入配置文件,第一次安装,没有配置文件。选择不导入
初始化安装nodejs和鸿蒙包管理工具ohpm
确认我们上一步的设置
同意协议,并开始下载相关安装包
等待下载安装完成
安装完成之后,可以使用下面的功能来检测刚才安装的环境是否正常
出现如下内容,就代表安装成功
Ubuntu20.04安装mysql8.0
apt-cache search mysql | grep mysql-server
sudo apt install mysql-server
sudo apt install mysql-server-8.0
sudo mysql
第一次可使用mysql直接登陆,后需需要带用户名和密码才能登陆
alter user 'root'@'localhost' identified with mysql_native_password by 'Cpcnet123$%^';
flush privileges;
mysql -uroot -p'Cpcnet123$%^'
use mysql;
update user set host='%' where user='root';
flush privileges;
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
将30行左右的bind-address = 127.0.0.1 注释掉
保存配置后重启mysql
sudo systemctl restart mysql
sudo ufw allow 3306
CREATE DATABASE miind_sdwan_1; CREATE DATABASE miind_sdwan_1_5;
CREATE USER 'TychonicUser'@'localhost' IDENTIFIED BY 'Cpcnet123$%^';
GRANT ALL PRIVILEGES ON `miind_sdwan_1_5`.* TO 'TychonicUser'@'localhost';
FLUSH PRIVILEGES;
这里是两个同名同密码的账号
CREATE USER 'TychonicUser'@'%' IDENTIFIED BY 'Cpcnet123$%^';
GRANT ALL PRIVILEGES ON `miind_sdwan_1_5`.* TO 'TychonicUser'@'%';
FLUSH PRIVILEGES;
前置环境安装
sudo apt-get install -y gcc sudo apt-get install -y libpcre3 libpcre3-dev sudo apt-get install -y zlib1g zlib1g-dev sudo apt-get install -y openssl sudo apt-get install -y libssl-dev
下载nginx源
wget http://nginx.org/download/nginx-1.21.6.tar.gz
解压
tar -zxvf nginx-1.21.6.tar.gz
进入目录
cd nginx-1.21.6/
执行初始化
./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_flv_module --with-http_gzip_static_module
编译
make sudo make install
建立link
sudo ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
配置apt-get的下载源
1、复制原文件备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2、编辑源列表文件
sudo vim /etc/apt/sources.list
3、将原来的列表删除,添加如下内容
注:jammy为系统版本号,根据不同系统修改不同版本号。
阿里云
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
清华云
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
Ubuntu源
deb http://cn.archive.ubuntu.com/ubuntu/ jammy main restricted deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates main restricted deb http://cn.archive.ubuntu.com/ubuntu/ jammy universe deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates universe deb http://cn.archive.ubuntu.com/ubuntu/ jammy multiverse deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates multiverse deb http://cn.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu jammy-security main restricted deb http://security.ubuntu.com/ubuntu jammy-security universe deb http://security.ubuntu.com/ubuntu jammy-security multiverse
4、运行
sudo apt-get update
5、运行
sudo apt-get upgrade
6、apt-get 常用命令
apt-cache search packagename 搜索包 apt-cache show packagename 获取包的相关信息,如说明、大小、版本等 apt-get install packagename 安装包 apt-get install packagename - - reinstall 重新安装包 apt-get -f install 修复安装"-f = --fix-missing" apt-get remove packagename 删除包 apt-get remove packagename - - purge 删除包,包括删除配置文件等 apt-get update 更新源 apt-get upgrade 更新已安装的包 apt-get dist-upgrade 升级系统 apt-get dselect-upgrade 使用 dselect 升级 apt-cache depends packagename 了解使用依赖 apt-cache rdepends packagename 是查看该包被哪些包依赖 apt-get build-dep packagename 安装相关的编译环境 apt-get source packagename 下载该包的源代码 apt-get clean 清理无用的包 apt-get autoclean 清理无用的包 apt-get check 检查是否有损坏的依赖
场景: vue-router 路由守卫 跳转前判断 pinia 状态 state的token是否存在 ,存在就跳转,不存在跳转到 登录页面。
科普一:pinia-plugin-persist 的使用
import { createPinia } from "pinia" import piniaPluginPersist from 'pinia-plugin-persist' const store = createPinia() store.use(piniaPluginPersist) export default store 复制代码 配置 : 复制代码 import { defineStore } from "pinia"; export const useUserStore = defineStore({ id: "user", state: () => { return { token: "" }; }, actions: { setToken(token: string) { this.token = token; } }, persist: { enabled: true, strategies: [ { key: "your key", storage: localStorage, }, ], }, });
支持 localStorage,sessionStorage 。
踩的坑:
当配合 路由使用时,持久化 存储失效了
答案:
userStore 初始化 必须放在 路由守卫里 才会生效, 必须放在 路由守卫里 才会生效, 必须放在 路由守卫里 才会生效。放在外面,持久化会失效,记录一下。
import { useUserStore } from '@/stores/user' { path: "/cart", name: "Cart", component: () => import(/* webpackChunkName: "cart" */ "../views/CartView.vue"), beforeEnter:(to, from, next)=>{ //这里是最关键的,一定要放到前置守卫里面初始化,持久化才生效 const userStore = useUserStore(); if( userStore.token ){ next(); }else{ next('/login'); } }