鼎鼎知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

在Ubuntu上运行第一个.NET Core应用程序.md 1.6KB

4 vuotta sitten
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. - 来到根目录:cd ~
  2. - 注册Microsoft的Repository: wget -q ...
  3. - 安装:sudo dpkg -i Packages-microsoft-prod.deb
  4. - 添加新的repository:sudo add-apt-repository universe
  5. - 安装:sudo apt install apt-transport-https
  6. - sudo apt update
  7. - 下载SDK
  8. ```
  9. sudo apt install dotnet-sdk-3.0
  10. ```
  11. - 登录MySQL: mysql -u root -p
  12. - 创建数据库:CREATE DATABASE MovieAppDb;
  13. - quit;
  14. - 再次登录:mysql -u dd -p
  15. - 显示数据库:SHOW DATABASES;
  16. - quit;
  17. - 创建网站目录:sudo mkdir -p /var/www/movie-app
  18. - 给目录权限:sudo chown dingding:dingding /var/www/movie-app
  19. - 来到网站目录
  20. - 安装git:
  21. ```
  22. sudo apt update
  23. git apt install git
  24. git --version
  25. sudo apt update
  26. sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
  27. - 来到github上的项目,在master分支选择tag,邮件复制地址
  28. - 下载到当前目录:wget https://github.com/git...
  29. - 解压:unzip git.zip
  30. - 来到源代码目录:cd git-*
  31. - 制作package: make prefix=/usr/lcoall all
  32. - 安装:sudo make prefix=/usr/local install
  33. - 配置git
  34. git config --global user.name ""
  35. git config --global user.email ""
  36. git config --list
  37. ```
  38. - 把git项目拷贝到当前目录
  39. ```
  40. git clone https://github.com
  41. ```
  42. - 修改连接字符串
  43. - 更新数据库
  44. ```
  45. 项目的ef和当前装的ef必须匹配
  46. dotnet tool install --global dotnet-ef --version
  47. dotnet --list-sdks
  48. dotnet tool install --global dotnet-ef --version 3.0.0
  49. 配置到全局:export PATH="$PATH:/usr/bin/"
  50. dotnet --help
  51. dotnet ef database update
  52. ```
  53. - 发布:dotnet publish
  54. - 运行: dotnet MvcMovie.dll