|
| 1 | +--- |
| 2 | +title: "Aloys的环境搭建手册" |
| 3 | +categories: |
| 4 | + - setup-environment |
| 5 | +tags: |
| 6 | + - 环境搭建 |
| 7 | +toc: true |
| 8 | +--- |
| 9 | + |
| 10 | + |
| 11 | +## Ubuntu 16.04安装SQLLite3 |
| 12 | + |
| 13 | +```shell |
| 14 | +jiangxin@db01:~$ sudo apt-get install sqlite3 |
| 15 | +jiangxin@db01:~$ sqlite3 test.db |
| 16 | +SQLite version 3.11.0 2016-02-15 17:29:24 |
| 17 | +Enter ".help" for usage hints. |
| 18 | +sqlite> create table mytable(id integer primary key, value text); |
| 19 | +sqlite> insert into mytable(id, value) values(1, 'Micheal'); |
| 20 | +sqlite> select * from mytable; |
| 21 | +1|Micheal |
| 22 | +sqlite> .help |
| 23 | +.backup ?DB? FILE Backup DB (default "main") to FILE |
| 24 | +.bail on|off Stop after hitting an error. Default OFF |
| 25 | +.binary on|off Turn binary output on or off. Default OFF |
| 26 | +.changes on|off Show number of rows changed by SQL |
| 27 | +.clone NEWDB Clone data into NEWDB from the existing database |
| 28 | +.databases List names and files of attached databases |
| 29 | +.dbinfo ?DB? Show status information about the database |
| 30 | +.dump ?TABLE? ... Dump the database in an SQL text format |
| 31 | + If TABLE specified, only dump tables matching |
| 32 | + LIKE pattern TABLE. |
| 33 | +.echo on|off Turn command echo on or off |
| 34 | +.eqp on|off Enable or disable automatic EXPLAIN QUERY PLAN |
| 35 | +.exit Exit this program |
| 36 | +.explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic |
| 37 | +.fullschema Show schema and the content of sqlite_stat tables |
| 38 | +.headers on|off Turn display of headers on or off |
| 39 | +.help Show this message |
| 40 | +.import FILE TABLE Import data from FILE into TABLE |
| 41 | +.indexes ?TABLE? Show names of all indexes |
| 42 | + If TABLE specified, only show indexes for tables |
| 43 | + matching LIKE pattern TABLE. |
| 44 | +.limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT |
| 45 | +.load FILE ?ENTRY? Load an extension library |
| 46 | +.log FILE|off Turn logging on or off. FILE can be stderr/stdout |
| 47 | +.mode MODE ?TABLE? Set output mode where MODE is one of: |
| 48 | + ascii Columns/rows delimited by 0x1F and 0x1E |
| 49 | + csv Comma-separated values |
| 50 | + column Left-aligned columns. (See .width) |
| 51 | + html HTML <table> code |
| 52 | + insert SQL insert statements for TABLE |
| 53 | + line One value per line |
| 54 | + list Values delimited by .separator strings |
| 55 | + tabs Tab-separated values |
| 56 | + tcl TCL list elements |
| 57 | +.nullvalue STRING Use STRING in place of NULL values |
| 58 | +.once FILENAME Output for the next SQL command only to FILENAME |
| 59 | +.open ?FILENAME? Close existing database and reopen FILENAME |
| 60 | +.output ?FILENAME? Send output to FILENAME or stdout |
| 61 | +.print STRING... Print literal STRING |
| 62 | +.prompt MAIN CONTINUE Replace the standard prompts |
| 63 | +.quit Exit this program |
| 64 | +.read FILENAME Execute SQL in FILENAME |
| 65 | +.restore ?DB? FILE Restore content of DB (default "main") from FILE |
| 66 | +.save FILE Write in-memory database into FILE |
| 67 | +.scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off |
| 68 | +.schema ?TABLE? Show the CREATE statements |
| 69 | + If TABLE specified, only show tables matching |
| 70 | + LIKE pattern TABLE. |
| 71 | +.separator COL ?ROW? Change the column separator and optionally the row |
| 72 | + separator for both the output mode and .import |
| 73 | +.shell CMD ARGS... Run CMD ARGS... in a system shell |
| 74 | +.show Show the current values for various settings |
| 75 | +.stats on|off Turn stats on or off |
| 76 | +.system CMD ARGS... Run CMD ARGS... in a system shell |
| 77 | +.tables ?TABLE? List names of tables |
| 78 | + If TABLE specified, only list tables matching |
| 79 | + LIKE pattern TABLE. |
| 80 | +.timeout MS Try opening locked tables for MS milliseconds |
| 81 | +.timer on|off Turn SQL timer on or off |
| 82 | +.trace FILE|off Output each SQL statement as it is run |
| 83 | +.vfsinfo ?AUX? Information about the top-level VFS |
| 84 | +.vfslist List all available VFSes |
| 85 | +.vfsname ?AUX? Print the name of the VFS stack |
| 86 | +.width NUM1 NUM2 ... Set column widths for "column" mode |
| 87 | + Negative values right-justify |
| 88 | +sqlite> .quit |
| 89 | +jiangxin@db01:~$\ |
| 90 | +``` |
| 91 | +
|
| 92 | +由于Sqlite本身不支持远程访问,如果需要在Windows上连接远程Linux上的Sqlite,需要在Linux上共享文件给Windows。 |
| 93 | +共享方式见: |
| 94 | +Ubuntu创建共享文件夹并支持Windows访问:http://jingyan.baidu.com/article/2fb0ba40a8283500f2ec5f35.html |
| 95 | +
|
| 96 | +
|
| 97 | +在Windows上打开资源浏览器,在输入框输入\\192.168.1.150 |
| 98 | +然后输入用户名、密码即可 |
| 99 | +
|
| 100 | + |
| 101 | +
|
| 102 | +
|
| 103 | + |
| 104 | +
|
| 105 | +将之前创建的test.db移到share/sqlite目录: |
| 106 | +
|
| 107 | +jiangxin@db01:~$ mv test.db share/sqlite/ |
| 108 | +
|
| 109 | +在Windows上用dbeaver连接Linux上的远程数据库 |
| 110 | +
|
| 111 | + |
| 112 | +
|
| 113 | +## 安装Prometheus |
| 114 | +下载地址: |
| 115 | +https://prometheus.io/download/ |
| 116 | +
|
| 117 | +jiangxin@tomcat:~$ sudo mkdir /usr/local/prometheus |
| 118 | +jiangxin@tomcat:~$ sudo chown -R jiangxin:jiangxin /usr/local/prometheus |
| 119 | +jiangxin@tomcat:~$ cd /usr/local/prometheus/ |
| 120 | +jiangxin@tomcat:/usr/local/prometheus$ ls |
| 121 | +prometheus-1.7.1.linux-amd64.tar.gz |
| 122 | +jiangxin@tomcat:/usr/local/prometheus$ tar -zxvf prometheus-1.7.1.linux-amd64.tar.gz |
| 123 | +jiangxin@tomcat:/usr/local/prometheus$ cd prometheus-1.7.1.linux-amd64/ |
| 124 | +
|
| 125 | +jiangxin@tomcat:/usr/local/prometheus/prometheus-1.7.1.linux-amd64$ sudo vim /etc/profile |
| 126 | +
|
| 127 | +export PROMETHEUS_HOME=/usr/local/prometheus/prometheus-1.7.1.linux-amd64 |
| 128 | +export PATH=$PATH:$PROMETHEUS_HOME |
| 129 | +
|
| 130 | +jiangxin@tomcat:/usr/local/prometheus/prometheus-1.7.1.linux-amd64$ source /etc/profile |
| 131 | +jiangxin@tomcat:/usr/local/prometheus/prometheus-1.7.1.linux-amd64$ cd |
| 132 | +### 启动 |
| 133 | +jiangxin@tomcat:~$ prometheus -config.file=${PROMETHEUS_HOME}/prometheus.yml |
| 134 | +INFO[0000] Starting prometheus (version=1.7.1, branch=master, revision=3afb3fffa3a29c3de865e1172fb740442e9d0133) source="main.go:88" |
| 135 | +INFO[0000] Build context (go=go1.8.3, user=root@0aa1b7fc430d, date=20170612-11:44:05) source="main.go:89" |
| 136 | +INFO[0000] Host details (Linux 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 tomcat (none)) source="main.go:90" |
| 137 | +INFO[0000] Loading configuration file /usr/local/prometheus/prometheus-1.7.1.linux-amd64/prometheus.yml source="main.go:252" |
| 138 | +INFO[0000] Loading series map and head chunks... source="storage.go:428" |
| 139 | +INFO[0000] 0 series loaded. source="storage.go:439" |
| 140 | +INFO[0000] Starting target manager... source="targetmanager.go:63" |
| 141 | +INFO[0000] Listening on :9090 source="web.go:259" |
| 142 | +
|
| 143 | +
|
| 144 | +
|
| 145 | +
|
| 146 | +### 查看界面 |
| 147 | +http://192.168.1.130:9090/metrics |
| 148 | +
|
| 149 | + |
| 150 | +
|
| 151 | +
|
| 152 | +
|
| 153 | +http://192.168.1.130:9090/graph |
| 154 | +
|
| 155 | + |
| 156 | +
|
| 157 | +
|
| 158 | +
|
| 159 | +## Windows 10系统下搭建Jenkins环境 |
| 160 | +
|
| 161 | +主要参考: |
| 162 | +http://www.cnblogs.com/edward2013/p/5269465.html |
| 163 | +但是没有安装ant,而且java、maven、tomcat都是使用的压缩包方式安装。 |
| 164 | +
|
| 165 | +## Ubuntu 16.04安装docker |
| 166 | +
|
| 167 | +主要参考: |
| 168 | +https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository |
| 169 | +
|
| 170 | +## 配置AOSP源码查看环境 |
| 171 | +
|
| 172 | +### 在Windows上安装Repo,同步AOSP代码【不推荐】 |
| 173 | +
|
| 174 | +第一个想到的方案是在Windows上配置Repo,然后下载AOSP源码,参考: |
| 175 | +Windows安装repo的真正解决方案:https://ysy950803.blog.csdn.net/article/details/104188793 |
| 176 | +但是就像Repo官网(https://gerrit.googlesource.com/git-repo/+/HEAD/docs/windows.md)说的那样: |
| 177 | +Repo is primarily developed on Linux with a lot of users on macOS. Windows is, unfortunately, not a common platform. There is support in repo for Windows, but there might be some rough edges. |
| 178 | +Keep in mind that Windows in general is “best effort” and “community supported”. That means we don't actively test or verify behavior, but rely heavily on users to report problems back to us, and to contribute fixes as needed. |
| 179 | +Windows版的Repo虽然可用,但是可能会出现各种各样的问题,这些问题可能会让我们在解决环境问题上分心过多,所以不推荐这种方式。 |
| 180 | +
|
| 181 | +### 在Linux上安装Repo,同步AOSP代码【推荐】 |
| 182 | +
|
| 183 | +根据实际情况有两种工作模式: |
| 184 | +1、 Linux作为AOSP代码的同步、存储、查看、修改、编译环境,大部分工作都是在Linux上完成,Android Studio也是安装在Linux上,这种我觉得是最完美的模式。但是要求Linux的性能足够好。由于我这边没有实际的Linux机器,是在Windows上用虚拟机配置的Linux环境,所以没有采用这种方法。 |
| 185 | +2、 Linux作为AOSP代码的同步、存储、编译环境,查看和修改工作在Windows上完成,具体的实现方式有两种: |
| 186 | +a) 用Samba服务器把Linux上的AOSP代码共享到Windows平台,然后在Windows平台上安装IDE环境,直接打开远程AOSP代码目录,查看和修改,这种方式的优点是配置简单,不用代码同步。但是我这边网速一般,而AOSP代码量太大,导致Android Studio经常卡死,所以我也放弃了这种方式。 |
| 187 | +b) 将android.iml/android.ipr以及常用的仓(比如frameworks/base frameworks/native等)使用rsync等工具同步到Windows平台,然后在Windows上使用Android Studio导入,进行查看和修改,修改完成后通过Beyondcompare工具将修改的内容同步到Linux平台进行编译等工作。这个各方面折中的方案。后续主要介绍这种工作环境的配置。 |
| 188 | +
|
| 189 | +#### 安装配置Linux环境 |
| 190 | +
|
| 191 | +如果已经有Linux机器,本步骤省略。我在家中没有,遂采用在Windows上安装Virtualbox,然后通过Virtualbox安装Linux(Ubuntu)。 |
| 192 | +同时按需安装Git/Vim/OpenSSH Server等工具,安装方式不再赘述,网上有很多。 |
| 193 | +
|
| 194 | +#### 下载AOSP源码 |
| 195 | +
|
| 196 | +在配置好的Linux环境中下载AOSP源码,Google官方的下载AOSP源码的方式:https://source.android.com/docs/setup/build/downloading。 |
| 197 | +但是由于墙的原因,这种方式不容易实现,所以推荐使用清华的镜像,使用指导:https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/。 |
| 198 | +Repo的使用方式可以参考:Repo实践指南:https://www.cnblogs.com/jiangxinnju/p/14274982.html |
| 199 | +
|
| 200 | +#### 配置Windows上的工具 |
| 201 | +1、 安装SSH客户端工具,这里推荐MobaXTerm,因为它不仅免费还自带了rsync命令行工具,可以非常方便从Linux上同步代码到Windows。 |
| 202 | +a) mkdir -p /drives/d/Code/sync/aosp/frameworks |
| 203 | +b) rsync -az --progress --delete --exclude=".git" android@192.168.1.125:/home/android/aosp/frameworks/base /drives/d/Code/sync/aosp/frameworks/ |
| 204 | +c) rsync -az --progress --delete --exclude=".git" android@192.168.1.125:/home/android/aosp/frameworks/native /drives/d/Code/sync/aosp/frameworks/ |
| 205 | +2、 安装BeyondCompare工具,方便对比,将修改的代码同步到Linux环境。 |
| 206 | +3、 安装Android Sudio,将AOSP源码导入到Android Studio进行查看:https://www.cnblogs.com/jiangxinnju/p/14426645.html |
| 207 | +4、 安装Source Insight工具,AS查看AOSP的Java代码比较合适,但是C/C++代码不支持跳转,着色也比较差,看这部分代码还是SI比较好用。 |
| 208 | +
|
| 209 | +## TensorFlow环境搭建 |
| 210 | +
|
| 211 | +### 预备条件 |
| 212 | + Ubuntu 22.04.2 LTS |
| 213 | + 配置好固定IP,安装SSH(Server)/Samba等基础网络连接软件 |
| 214 | +
|
0 commit comments